pool = store->get_zone_params().domain_root;
}
- int list_keys_init(RGWRados *store, void **phandle) override
+ int list_keys_init(RGWRados *store, const string& marker, void **phandle)
{
list_keys_info *info = new list_keys_info;
info->store = store;
+ int ret = store->list_raw_objects_init(store->get_zone_params().domain_root, marker,
+ &info->ctx);
+ if (ret < 0) {
+ return ret;
+ }
*phandle = (void *)info;
return 0;
list<string> unfiltered_keys;
- int ret = store->list_raw_objects(store->get_zone_params().domain_root, no_filter,
- max, info->ctx, unfiltered_keys, truncated);
+ int ret = store->list_raw_objects_next(no_filter, max, info->ctx,
+ unfiltered_keys, truncated);
if (ret < 0 && ret != -ENOENT)
return ret;
if (ret == -ENOENT) {
list_keys_info *info = static_cast<list_keys_info *>(handle);
delete info;
}
+
+ string get_marker(void *handle) {
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
+ return info->store->list_raw_objs_get_cursor(info->ctx);
+ }
};
class RGWBucketInstanceMetadataHandler : public RGWMetadataHandler {
pool = store->get_zone_params().domain_root;
}
- int list_keys_init(RGWRados *store, void **phandle) override
- {
+ int list_keys_init(RGWRados *store, const string& marker, void **phandle) override {
list_keys_info *info = new list_keys_info;
info->store = store;
+ int ret = store->list_raw_objects_init(store->get_zone_params().domain_root, marker,
+ &info->ctx);
+ if (ret < 0) {
+ return ret;
+ }
*phandle = (void *)info;
return 0;
list<string> unfiltered_keys;
- int ret = store->list_raw_objects(store->get_zone_params().domain_root, no_filter,
- max, info->ctx, unfiltered_keys, truncated);
+ int ret = store->list_raw_objects_next(no_filter, max, info->ctx,
+ unfiltered_keys, truncated);
if (ret < 0 && ret != -ENOENT)
return ret;
if (ret == -ENOENT) {
delete info;
}
+ string get_marker(void *handle) {
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
+ return info->store->list_raw_objs_get_cursor(info->ctx);
+ }
+
/*
* hash entry for mdlog placement. Use the same hash key we'd have for the bucket entry
* point, so that the log entries end up at the same log shard, so that we process them
class RGWMetadataTopHandler : public RGWMetadataHandler {
struct iter_data {
- list<string> sections;
- list<string>::iterator iter;
+ set<string> sections;
+ set<string>::iterator iter;
};
public:
int remove(RGWRados *store, string& entry, RGWObjVersionTracker& objv_tracker) override { return -ENOTSUP; }
- int list_keys_init(RGWRados *store, void **phandle) override {
+ int list_keys_init(RGWRados *store, const string& marker, void **phandle) override {
iter_data *data = new iter_data;
- store->meta_mgr->get_sections(data->sections);
- data->iter = data->sections.begin();
+ list<string> sections;
+ store->meta_mgr->get_sections(sections);
+ for (auto& s : sections) {
+ data->sections.insert(s);
+ }
+ data->iter = data->sections.lower_bound(marker);
*phandle = data;
delete data;
}
+
+ virtual string get_marker(void *handle) {
+ iter_data *data = static_cast<iter_data *>(handle);
+
+ if (data->iter != data->sections.end()) {
+ return *(data->iter);
+ }
+
+ return string();
+ }
};
static RGWMetadataTopHandler md_top_handler;
RGWMetadataHandler *handler;
};
-
int RGWMetadataManager::list_keys_init(string& section, void **handle)
+{
+ return list_keys_init(section, string(), handle);
+}
+
+int RGWMetadataManager::list_keys_init(string& section, const string& marker, void **handle)
{
string entry;
RGWMetadataHandler *handler;
list_keys_handle *h = new list_keys_handle;
h->handler = handler;
- ret = handler->list_keys_init(store, &h->handle);
+ ret = handler->list_keys_init(store, marker, &h->handle);
if (ret < 0) {
delete h;
return ret;
return handler->list_keys_next(h->handle, max, keys, truncated);
}
-
void RGWMetadataManager::list_keys_complete(void *handle)
{
list_keys_handle *h = static_cast<list_keys_handle *>(handle);
delete h;
}
+string RGWMetadataManager::get_marker(void *handle)
+{
+ list_keys_handle *h = static_cast<list_keys_handle *>(handle);
+
+ return h->handler->get_marker(h->handle);
+}
+
void RGWMetadataManager::dump_log_entry(cls_log_entry& entry, Formatter *f)
{
f->open_object_section("entry");
real_time mtime, JSONObj *obj, sync_type_t type) = 0;
virtual int remove(RGWRados *store, string& entry, RGWObjVersionTracker& objv_tracker) = 0;
- virtual int list_keys_init(RGWRados *store, void **phandle) = 0;
+ virtual int list_keys_init(RGWRados *store, const string& marker, void **phandle) = 0;
virtual int list_keys_next(void *handle, int max, list<string>& keys, bool *truncated) = 0;
virtual void list_keys_complete(void *handle) = 0;
+ virtual string get_marker(void *handle) = 0;
+
/* key to use for hashing entries for log shard placement */
virtual void get_hash_key(const string& section, const string& key, string& hash_key) {
hash_key = section + ":" + key;
int remove(string& metadata_key);
int list_keys_init(string& section, void **phandle);
+ int list_keys_init(string& section, const string& marker, void **phandle);
int list_keys_next(void *handle, int max, list<string>& keys, bool *truncated);
void list_keys_complete(void *handle);
+ string get_marker(void *handle);
+
void dump_log_entry(cls_log_entry& entry, Formatter *f);
void get_sections(list<string>& sections);
pool = store->get_zone_params().user_uid_pool;
}
- int list_keys_init(RGWRados *store, void **phandle) override
+ int list_keys_init(RGWRados *store, const string& marker, void **phandle) override
{
list_keys_info *info = new list_keys_info;
info->store = store;
+ int ret = store->list_raw_objects_init(store->get_zone_params().user_uid_pool, marker,
+ &info->ctx);
+ if (ret < 0) {
+ return ret;
+ }
+
*phandle = (void *)info;
return 0;
list<string> unfiltered_keys;
- int ret = store->list_raw_objects(store->get_zone_params().user_uid_pool, no_filter,
- max, info->ctx, unfiltered_keys, truncated);
+ int ret = store->list_raw_objects_next(no_filter, max, info->ctx,
+ unfiltered_keys, truncated);
if (ret < 0 && ret != -ENOENT)
return ret;
if (ret == -ENOENT) {
list_keys_info *info = static_cast<list_keys_info *>(handle);
delete info;
}
+
+ string get_marker(void *handle) {
+ list_keys_info *info = static_cast<list_keys_info *>(handle);
+ return info->store->list_raw_objs_get_cursor(info->ctx);
+ }
};
void rgw_user_init(RGWRados *store)