]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: format bucket.instance meta entries nicely
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 24 Jun 2013 04:44:05 +0000 (21:44 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 24 Jun 2013 04:44:05 +0000 (21:44 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 5d3019e06344e808ea6bc2497f7b840f84ef0ce0..d7ca725c83a664d4c73bfff112e0dd82cda527bf 100644 (file)
@@ -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));
       }
     }
 
index c883e74f44a5fdf36d5b9a03097bfa30e4a6c413..c8cb53d14337fcdf990c7c524a31db7717e0464b 100644 (file)
@@ -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);
 }
index 990bb1372ceac2ff951028613ed32a54db97b281..e6298e733531cbf5bbd191348ba91ca511e9de55 100644 (file)
@@ -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()) {