{
int ret;
buckets.clear();
- string buckets_obj_id;
+ std::string buckets_obj_id;
rgw_get_buckets_obj(user_id, buckets_obj_id);
rgw_raw_obj obj(store->get_zone_params().user_uid_pool, buckets_obj_id);
- list<cls_user_bucket_entry> entries;
bool truncated = false;
string m = marker;
}
do {
+ std::list<cls_user_bucket_entry> entries;
ret = store->cls_user_list_buckets(obj, m, end_marker, max - total, entries, &m, &truncated);
- if (ret == -ENOENT)
+ if (ret == -ENOENT) {
ret = 0;
+ }
- if (ret < 0)
+ if (ret < 0) {
return ret;
+ }
- for (const auto& entry : entries) {
- buckets.add(RGWBucketEnt(user_id, entry));
+ for (auto& entry : entries) {
+ buckets.add(RGWBucketEnt(user_id, std::move(entry)));
total++;
}
rgw_bucket bucket;
size_t size;
size_t size_rounded;
- real_time creation_time;
+ ceph::real_time creation_time;
uint64_t count;
+ /* The placement_rule is necessary to calculate per-storage-policy statics
+ * of the Swift API. Although the info available in RGWBucketInfo, we need
+ * to duplicate it here to not affect the performance of buckets listing. */
+ std::string placement_rule;
+
RGWBucketEnt()
: size(0),
size_rounded(0),
}
RGWBucketEnt(const RGWBucketEnt&) = default;
RGWBucketEnt(RGWBucketEnt&&) = default;
-
- RGWBucketEnt& operator=(const RGWBucketEnt&) = default;
-
- explicit RGWBucketEnt(const rgw_user& u, const cls_user_bucket_entry& e)
- : bucket(u, e.bucket),
+ explicit RGWBucketEnt(const rgw_user& u, cls_user_bucket_entry&& e)
+ : bucket(u, std::move(e.bucket)),
size(e.size),
size_rounded(e.size_rounded),
creation_time(e.creation_time),
count(e.count) {
}
+ RGWBucketEnt& operator=(const RGWBucketEnt&) = default;
+
void convert(cls_user_bucket_entry *b) const {
bucket.convert(&b->bucket);
b->size = size;