summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-09-17 10:11:54 -0700
committerSamuel Just <sam.just@inktank.com>2013-09-19 12:52:53 -0700
commitd315f96abe5c9a801314b6cd39e395793913e317 (patch)
tree4c257e716f391a0759a8ae8b381ae667b10ca083
parent36d2226211f7b3f5fb79763e30e59e5a1e6676cf (diff)
downloadceph-d315f96abe5c9a801314b6cd39e395793913e317.tar.gz
PGBackend,ReplicatedBackend: add interfaces for scanning the pg
This will be important since the erasure coded pg will have a different on-disk format than the replicated backend. Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/PGBackend.h20
-rw-r--r--src/osd/ReplicatedBackend.cc49
-rw-r--r--src/osd/ReplicatedBackend.h20
3 files changed, 89 insertions, 0 deletions
diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h
index e3cc05bf345..408c589a08a 100644
--- a/src/osd/PGBackend.h
+++ b/src/osd/PGBackend.h
@@ -205,6 +205,26 @@
virtual void clear_temp_obj(const hobject_t &oid) = 0;
virtual ~PGBackend() {}
+
+ /// List objects in collection
+ virtual int objects_list_partial(
+ const hobject_t &begin,
+ int min,
+ int max,
+ snapid_t seq,
+ vector<hobject_t> *ls,
+ hobject_t *next) = 0;
+
+ virtual int objects_list_range(
+ const hobject_t &start,
+ const hobject_t &end,
+ snapid_t seq,
+ vector<hobject_t> *ls) = 0;
+
+ virtual int objects_get_attr(
+ const hobject_t &hoid,
+ const string &attr,
+ bufferlist *out) = 0;
};
#endif
diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc
index 9868e7af2c8..1e10ce10c23 100644
--- a/src/osd/ReplicatedBackend.cc
+++ b/src/osd/ReplicatedBackend.cc
@@ -194,3 +194,52 @@ void ReplicatedBackend::on_flushed()
assert(0 == "found garbage in the temp collection");
}
}
+
+
+int ReplicatedBackend::objects_list_partial(
+ const hobject_t &begin,
+ int min,
+ int max,
+ snapid_t seq,
+ vector<hobject_t> *ls,
+ hobject_t *next)
+{
+ return osd->store->collection_list_partial(
+ coll,
+ begin,
+ min,
+ max,
+ seq,
+ ls,
+ next);
+}
+
+int ReplicatedBackend::objects_list_range(
+ const hobject_t &start,
+ const hobject_t &end,
+ snapid_t seq,
+ vector<hobject_t> *ls)
+{
+ return osd->store->collection_list_range(
+ coll,
+ start,
+ end,
+ seq,
+ ls);
+}
+
+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->push_back(bp);
+ return r;
+}
diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h
index af8b3e291b6..cf9bf7c3321 100644
--- a/src/osd/ReplicatedBackend.h
+++ b/src/osd/ReplicatedBackend.h
@@ -148,6 +148,26 @@ public:
f->close_section();
}
}
+
+ /// 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);
private:
// push
struct PushInfo {