diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-23 21:44:05 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-23 21:44:05 -0700 |
commit | 5dd137ace403f8fe3fc1770acff862e4a5abd9d2 (patch) | |
tree | 1c81ca5d2a24d6adca7ddb27a01d1f67f39cae61 | |
parent | 4e90c5ec2963728b29e378a8b10f4a95bb6c0102 (diff) | |
download | ceph-5dd137ace403f8fe3fc1770acff862e4a5abd9d2.tar.gz |
rgw: format bucket.instance meta entries nicely
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_bucket.cc | 7 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 9 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 5d3019e0634..d7ca725c83a 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<string>::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 c883e74f44a..c8cb53d1433 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<string, bufferlist> *pattrs) { - /* entry in the format <bucket>/<bucket_id> */ - 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 990bb1372ce..e6298e73353 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()) { |