]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWGetBucketInstanceInfoCR takes rgw_bucket or metadata key
authorCasey Bodley <cbodley@redhat.com>
Thu, 7 Sep 2017 20:17:46 +0000 (16:17 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 10 Nov 2017 18:23:02 +0000 (13:23 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 5f4fd72cf3a50c133fdd4acafd0073dfa4bf3e14..06de89a8a20b3b09a90b3906e374337b9e323677 100644 (file)
@@ -482,10 +482,10 @@ bool RGWOmapAppend::finish() {
 int RGWAsyncGetBucketInstanceInfo::_send_request()
 {
   RGWObjectCtx obj_ctx(store);
-  int r = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info, NULL, NULL);
+  int r = store->get_bucket_instance_from_oid(obj_ctx, oid, *bucket_info, NULL, NULL);
   if (r < 0) {
     ldout(store->ctx(), 0) << "ERROR: failed to get bucket instance info for "
-        << bucket << dendl;
+        << oid << dendl;
     return r;
   }
 
index 4f9089a9862703b7ae4087dada8c7e9cef8a3575..cb0ba580897328069d84b7cab7bfb3fe23ad6dd2 100644 (file)
@@ -670,32 +670,40 @@ public:
 
 class RGWAsyncGetBucketInstanceInfo : public RGWAsyncRadosRequest {
   RGWRados *store;
-  rgw_bucket bucket;
+  const std::string oid;
   RGWBucketInfo *bucket_info;
 
 protected:
   int _send_request() override;
 public:
   RGWAsyncGetBucketInstanceInfo(RGWCoroutine *caller, RGWAioCompletionNotifier *cn,
-                                RGWRados *_store, const rgw_bucket& bucket,
+                                RGWRados *_store, const std::string& oid,
                                 RGWBucketInfo *_bucket_info)
     : RGWAsyncRadosRequest(caller, cn), store(_store),
-      bucket(bucket), bucket_info(_bucket_info) {}
+      oid(oid), bucket_info(_bucket_info) {}
 };
 
 class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
   RGWAsyncRadosProcessor *async_rados;
   RGWRados *store;
-  rgw_bucket bucket;
+  const std::string oid;
   RGWBucketInfo *bucket_info;
 
-  RGWAsyncGetBucketInstanceInfo *req;
+  RGWAsyncGetBucketInstanceInfo *req{nullptr};
   
 public:
+  // metadata key constructor
+  RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
+                             const std::string& meta_key, RGWBucketInfo *_bucket_info)
+    : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
+      oid(RGW_BUCKET_INSTANCE_MD_PREFIX + meta_key),
+      bucket_info(_bucket_info) {}
+  // rgw_bucket constructor
   RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
                              const rgw_bucket& bucket, RGWBucketInfo *_bucket_info)
     : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
-      bucket(bucket), bucket_info(_bucket_info), req(NULL) {}
+      oid(RGW_BUCKET_INSTANCE_MD_PREFIX + bucket.get_key(':')),
+      bucket_info(_bucket_info) {}
   ~RGWGetBucketInstanceInfoCR() override {
     request_cleanup();
   }
@@ -707,7 +715,7 @@ public:
   }
 
   int send_request() override {
-    req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, bucket, bucket_info);
+    req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, oid, bucket_info);
     async_rados->queue(req);
     return 0;
   }