]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: Interim collection_list* functions in ObjectStore
authorDavid Zafman <david.zafman@inktank.com>
Mon, 23 Sep 2013 20:02:16 +0000 (13:02 -0700)
committerDavid Zafman <david.zafman@inktank.com>
Thu, 26 Sep 2013 18:29:05 +0000 (11:29 -0700)
Handle ghobject_t to hobject_t conv of collection_list* funcs
Temporary code so that this branch doesn't break master

Signed-off-by: David Zafman <david.zafman@inktank.com>
src/os/ObjectStore.cc
src/os/ObjectStore.h

index 97c858b67739c1f95442efdc5288c90e258f7570..84549821affd0dacb4197ac361749c8f4e21c919 100644 (file)
@@ -15,6 +15,7 @@
 #include <tr1/memory>
 #include "ObjectStore.h"
 #include "common/Formatter.h"
+#include "FileStore.h"
 
 ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s)
 {
@@ -497,3 +498,47 @@ void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transac
   o.push_back(t);  
 }
 
+int ObjectStore::collection_list(coll_t c, vector<hobject_t>& o)
+{
+  vector<ghobject_t> go;
+  FileStore *fs = dynamic_cast<FileStore * >(this);
+  int ret = fs->collection_list(c, go);
+  if (ret == 0) {
+    o.reserve(go.size());
+    for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++)
+      o.push_back(i->hobj);
+  }
+  return ret;
+}
+
+int ObjectStore::collection_list_partial(coll_t c, hobject_t start,
+                             int min, int max, snapid_t snap,
+                                     vector<hobject_t> *ls, hobject_t *next)
+{
+  vector<ghobject_t> go;
+  ghobject_t gnext, gstart(start);
+  FileStore *fs = dynamic_cast<FileStore * >(this);
+  int ret = fs->collection_list_partial(c, gstart, min, max, snap, &go, &gnext);
+  if (ret == 0) {
+    *next = gnext.hobj;
+    ls->reserve(go.size());
+    for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++)
+      ls->push_back(i->hobj);
+  }
+  return ret;
+}
+
+int ObjectStore::collection_list_range(coll_t c, hobject_t start, hobject_t end,
+                           snapid_t seq, vector<hobject_t> *ls)
+{
+  vector<ghobject_t> go;
+  ghobject_t gstart(start), gend(end);
+  FileStore *fs = dynamic_cast<FileStore * >(this);
+  int ret = fs->collection_list_range(c, gstart, gend, seq, &go);
+  if (ret == 0) {
+    ls->reserve(go.size());
+    for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++)
+      ls->push_back(i->hobj);
+  }
+  return ret;
+}
index aea12c2aa2ce19e13b8240daefbdf9cccbf48fcc..07473b344f54cde97558935d9f819e669e95fdc9 100644 (file)
@@ -950,6 +950,16 @@ public:
   virtual int collection_list_range(coll_t c, ghobject_t start, ghobject_t end,
                                     snapid_t seq, vector<ghobject_t> *ls) = 0;
 
+  //TODO: Remove
+  int collection_list(coll_t c, vector<hobject_t>& o);
+
+  int collection_list_partial(coll_t c, hobject_t start,
+                                     int min, int max, snapid_t snap,
+                                     vector<hobject_t> *ls, hobject_t *next);
+
+  int collection_list_range(coll_t c, hobject_t start, hobject_t end,
+                                    snapid_t seq, vector<hobject_t> *ls);
+
   /// OMAP
   /// Get omap contents
   virtual int omap_get(