From: Yehuda Sadeh Date: Mon, 24 Jun 2013 04:44:05 +0000 (-0700) Subject: rgw: format bucket.instance meta entries nicely X-Git-Tag: v0.67-rc1~128^2~50 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5dd137ace403f8fe3fc1770acff862e4a5abd9d2;p=ceph.git rgw: format bucket.instance meta entries nicely Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 5d3019e06344..d7ca725c83a6 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1571,13 +1571,14 @@ public: if (ret < 0) return ret; - // now filter out the system entries + int prefix_size = sizeof(RGW_BUCKET_INSTANCE_MD_PREFIX) - 1; + // now filter in the relevant entries list::iterator iter; for (iter = unfiltered_keys.begin(); iter != unfiltered_keys.end(); ++iter) { string& k = *iter; - if (k[0] != '.') { - keys.push_back(k); + if (k.compare(0, prefix_size, RGW_BUCKET_INSTANCE_MD_PREFIX) == 0) { + keys.push_back(k.substr(prefix_size)); } } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index c883e74f44a5..c8cb53d14337 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4461,18 +4461,17 @@ int RGWRados::get_bucket_stats(rgw_bucket& bucket, uint64_t *bucket_ver, uint64_ void RGWRados::get_bucket_meta_oid(rgw_bucket& bucket, string& oid) { - oid = ".bucket.meta." + bucket.bucket_id; + oid = RGW_BUCKET_INSTANCE_MD_PREFIX + bucket.name + ":" + bucket.bucket_id; } -int RGWRados::get_bucket_instance_info(void *ctx, string& name, RGWBucketInfo& info, +int RGWRados::get_bucket_instance_info(void *ctx, string& entry, RGWBucketInfo& info, time_t *pmtime, map *pattrs) { - /* entry in the format / */ - int pos = name.find('/'); + int pos = entry.find(':'); if (pos < 0) { return -EINVAL; } - string oid = ".bucket.meta." + name.substr(pos + 1); + string oid = RGW_BUCKET_INSTANCE_MD_PREFIX + entry; return get_bucket_instance_from_oid(ctx, oid, info, pmtime, pattrs); } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 990bb1372cea..e6298e733531 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -26,6 +26,8 @@ class RGWGC; #define RGW_OBJ_NS_MULTIPART "multipart" #define RGW_OBJ_NS_SHADOW "shadow" +#define RGW_BUCKET_INSTANCE_MD_PREFIX ".bucket.meta." + static inline void prepend_bucket_marker(rgw_bucket& bucket, string& orig_oid, string& oid) { if (bucket.marker.empty() || orig_oid.empty()) {