These also are unchanged in ECBackend.
Signed-off-by: Samuel Just <sam.just@inktank.com>
}
+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,
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,
}
}
-
-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,
}
}
- /// 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,