]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedBackend/PGBackend: move objects_* methods into PGBackend
authorSamuel Just <sam.just@inktank.com>
Thu, 23 Jan 2014 01:50:04 +0000 (17:50 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 18 Feb 2014 04:11:06 +0000 (20:11 -0800)
These also are unchanged in ECBackend.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PGBackend.cc
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h

index 3d46da16d3657e8b124e4cadb1b6f862d82741e3..452a9bbf1fa90f1add7ea255a8a14f3f82b23806 100644 (file)
@@ -73,6 +73,96 @@ void PGBackend::rollback(
 }
 
 
+int PGBackend::objects_list_partial(
+  const hobject_t &begin,
+  int min,
+  int max,
+  snapid_t seq,
+  vector<hobject_t> *ls,
+  hobject_t *next)
+{
+  assert(ls);
+  ghobject_t _next(begin);
+  ls->reserve(max);
+  int r = 0;
+  while (!_next.is_max() && ls->size() < (unsigned)min) {
+    vector<ghobject_t> objects;
+    int r = store->collection_list_partial(
+      coll,
+      _next,
+      min - ls->size(),
+      max - ls->size(),
+      seq,
+      &objects,
+      &_next);
+    if (r != 0)
+      break;
+    for (vector<ghobject_t>::iterator i = objects.begin();
+        i != objects.end();
+        ++i) {
+      if (i->is_no_gen()) {
+       ls->push_back(i->hobj);
+      }
+    }
+  }
+  if (r == 0)
+    *next = _next.hobj;
+  return r;
+}
+
+int PGBackend::objects_list_range(
+  const hobject_t &start,
+  const hobject_t &end,
+  snapid_t seq,
+  vector<hobject_t> *ls)
+{
+  assert(ls);
+  vector<ghobject_t> objects;
+  int r = store->collection_list_range(
+    coll,
+    start,
+    end,
+    seq,
+    &objects);
+  ls->reserve(objects.size());
+  for (vector<ghobject_t>::iterator i = objects.begin();
+       i != objects.end();
+       ++i) {
+    if (i->is_no_gen()) {
+      ls->push_back(i->hobj);
+    }
+  }
+  return r;
+}
+
+int PGBackend::objects_get_attr(
+  const hobject_t &hoid,
+  const string &attr,
+  bufferlist *out)
+{
+  bufferptr bp;
+  int r = store->getattr(
+    coll,
+    hoid,
+    attr.c_str(),
+    bp);
+  if (r >= 0 && out) {
+    out->clear();
+    out->push_back(bp);
+  }
+  return r;
+}
+
+int PGBackend::objects_get_attrs(
+  const hobject_t &hoid,
+  map<string, bufferlist> *out)
+{
+  return store->getattrs(
+    coll,
+    hoid,
+    *out);
+}
+
 void PGBackend::rollback_setattrs(
   const hobject_t &hoid,
   map<string, boost::optional<bufferlist> > &old_attrs,
index 57d0a25ec1ce3d854e13c2912503925dc7d17efd..c6215525b9c5b21036fcac1e976c3cd9a2e2abbb 100644 (file)
      ObjectStore::Transaction *t);
 
    /// List objects in collection
-   virtual int objects_list_partial(
+   int objects_list_partial(
      const hobject_t &begin,
      int min,
      int max,
      snapid_t seq,
      vector<hobject_t> *ls,
-     hobject_t *next) = 0;
+     hobject_t *next);
 
-   virtual int objects_list_range(
+   int objects_list_range(
      const hobject_t &start,
      const hobject_t &end,
      snapid_t seq,
-     vector<hobject_t> *ls) = 0;
+     vector<hobject_t> *ls);
 
-   virtual int objects_get_attr(
+   int objects_get_attr(
      const hobject_t &hoid,
      const string &attr,
-     bufferlist *out) = 0;
+     bufferlist *out);
 
-   virtual int objects_get_attrs(
+   int objects_get_attrs(
      const hobject_t &hoid,
-     map<string, bufferlist> *out) = 0;
+     map<string, bufferlist> *out);
 
    virtual int objects_read_sync(
      const hobject_t &hoid,
index 31885494fa2ce0e584da73e71c9b748bee10f176..2da8cd1d26c9c02a605af2e4360434a8d52a202f 100644 (file)
@@ -234,99 +234,6 @@ void ReplicatedBackend::on_flushed()
   }
 }
 
-
-int ReplicatedBackend::objects_list_partial(
-  const hobject_t &begin,
-  int min,
-  int max,
-  snapid_t seq,
-  vector<hobject_t> *ls,
-  hobject_t *next)
-{
-  assert(ls);
-  ghobject_t _next(begin);
-  ls->reserve(max);
-  int r = 0;
-  while (!_next.is_max() && ls->size() < (unsigned)min) {
-    vector<ghobject_t> objects;
-    int r = osd->store->collection_list_partial(
-      coll,
-      _next,
-      min - ls->size(),
-      max - ls->size(),
-      seq,
-      &objects,
-      &_next);
-    if (r != 0)
-      break;
-    for (vector<ghobject_t>::iterator i = objects.begin();
-        i != objects.end();
-        ++i) {
-      assert(i->is_no_shard());
-      if (i->is_no_gen()) {
-       ls->push_back(i->hobj);
-      }
-    }
-  }
-  if (r == 0)
-    *next = _next.hobj;
-  return r;
-}
-
-int ReplicatedBackend::objects_list_range(
-  const hobject_t &start,
-  const hobject_t &end,
-  snapid_t seq,
-  vector<hobject_t> *ls)
-{
-  assert(ls);
-  vector<ghobject_t> objects;
-  int r = osd->store->collection_list_range(
-    coll,
-    start,
-    end,
-    seq,
-    &objects);
-  ls->reserve(objects.size());
-  for (vector<ghobject_t>::iterator i = objects.begin();
-       i != objects.end();
-       ++i) {
-    assert(i->is_no_shard());
-    if (i->is_no_gen()) {
-      ls->push_back(i->hobj);
-    }
-  }
-  return r;
-}
-
-int ReplicatedBackend::objects_get_attr(
-  const hobject_t &hoid,
-  const string &attr,
-  bufferlist *out)
-{
-  bufferptr bp;
-  int r = osd->store->getattr(
-    coll,
-    hoid,
-    attr.c_str(),
-    bp);
-  if (r >= 0 && out) {
-    out->clear();
-    out->push_back(bp);
-  }
-  return r;
-}
-
-int ReplicatedBackend::objects_get_attrs(
-  const hobject_t &hoid,
-  map<string, bufferlist> *out)
-{
-  return osd->store->getattrs(
-    coll,
-    hoid,
-    *out);
-}
-
 int ReplicatedBackend::objects_read_sync(
   const hobject_t &hoid,
   uint64_t off,
index 9b996217dc324e8dc5edf2fec8de30055687d5fe..611b9bfaa43b5086e78aedd9e74126255c67e2d5 100644 (file)
@@ -154,30 +154,6 @@ public:
     }
   }
 
-  /// List objects in collection
-  int objects_list_partial(
-    const hobject_t &begin,
-    int min,
-    int max,
-    snapid_t seq,
-    vector<hobject_t> *ls,
-    hobject_t *next);
-
-  int objects_list_range(
-    const hobject_t &start,
-    const hobject_t &end,
-    snapid_t seq,
-    vector<hobject_t> *ls);
-
-  int objects_get_attr(
-    const hobject_t &hoid,
-    const string &attr,
-    bufferlist *out);
-
-  int objects_get_attrs(
-    const hobject_t &hoid,
-    map<string, bufferlist> *out);
-
   int objects_read_sync(
     const hobject_t &hoid,
     uint64_t off,