]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add RGWAsyncPutBucketInstanceInfoCR
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 18 May 2021 21:56:27 +0000 (17:56 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 1 Feb 2022 20:22:50 +0000 (15:22 -0500)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 3ddca701009b1234fe0eccd0b9dd08492a9544bf..7fb5396304512de54a284544e2be6c8c440ea8be 100644 (file)
@@ -604,6 +604,19 @@ int RGWAsyncGetBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
   return 0;
 }
 
+int RGWAsyncPutBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
+{
+  auto r = store->getRados()->put_bucket_instance_info(bucket_info, exclusive,
+                                                      mtime, attrs, dpp);
+  if (r < 0) {
+    ldpp_dout(dpp, 0) << "ERROR: failed to put bucket instance info for "
+                     << bucket_info.bucket << dendl;
+    return r;
+  }
+
+  return 0;
+}
+
 RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(
   const DoutPrefixProvider *dpp,
   rgw::sal::RadosStore* store,
index f83080d53e7bba5f6f833d04429be5cea3ce8b25..62dc104c7e59052dae8a5195b8fd64a14dfa0769 100644 (file)
@@ -878,6 +878,29 @@ public:
   std::map<std::string, bufferlist> attrs;
 };
 
+class RGWAsyncPutBucketInstanceInfo : public RGWAsyncRadosRequest {
+  rgw::sal::RadosStore* store;
+  RGWBucketInfo& bucket_info;
+  bool exclusive;
+  real_time mtime;
+  std::map<std::string, ceph::bufferlist>* attrs;
+  const DoutPrefixProvider *dpp;
+
+protected:
+  int _send_request(const DoutPrefixProvider *dpp) override;
+public:
+  RGWAsyncPutBucketInstanceInfo(RGWCoroutine* caller,
+                               RGWAioCompletionNotifier* cn,
+                                rgw::sal::RadosStore* store,
+                               RGWBucketInfo& bucket_info,
+                               bool exclusive,
+                               real_time mtime,
+                               std::map<std::string, ceph::bufferlist>* attrs,
+                                const DoutPrefixProvider* dpp)
+    : RGWAsyncRadosRequest(caller, cn), store(store), bucket_info(bucket_info),
+      exclusive(exclusive), mtime(mtime), attrs(attrs), dpp(dpp) {}
+};
+
 class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
   RGWAsyncRadosProcessor *async_rados;
   rgw::sal::RadosStore* store;
@@ -887,7 +910,7 @@ class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
   const DoutPrefixProvider *dpp;
 
   RGWAsyncGetBucketInstanceInfo *req{nullptr};
-  
+
 public:
   // rgw_bucket constructor
   RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RadosStore* _store,
@@ -921,6 +944,52 @@ public:
   }
 };
 
+class RGWPutBucketInstanceInfoCR : public RGWSimpleCoroutine {
+  RGWAsyncRadosProcessor *async_rados;
+  rgw::sal::RadosStore* store;
+  RGWBucketInfo& bucket_info;
+  bool exclusive;
+  real_time mtime;
+  std::map<std::string, ceph::bufferlist>* attrs;
+  const DoutPrefixProvider *dpp;
+
+  RGWAsyncPutBucketInstanceInfo* req = nullptr;
+
+public:
+  // rgw_bucket constructor
+  RGWPutBucketInstanceInfoCR(RGWAsyncRadosProcessor *async_rados,
+                            rgw::sal::RadosStore* store,
+                            RGWBucketInfo& bucket_info,
+                            bool exclusive,
+                            real_time mtime,
+                            std::map<std::string, ceph::bufferlist>* attrs,
+                             const DoutPrefixProvider *dpp)
+    : RGWSimpleCoroutine(store->ctx()), async_rados(async_rados), store(store),
+      bucket_info(bucket_info), exclusive(exclusive),
+      mtime(mtime), attrs(attrs), dpp(dpp) {}
+  ~RGWPutBucketInstanceInfoCR() override {
+    request_cleanup();
+  }
+  void request_cleanup() override {
+    if (req) {
+      req->finish();
+      req = nullptr;
+    }
+  }
+
+  int send_request(const DoutPrefixProvider *dpp) override {
+    req = new RGWAsyncPutBucketInstanceInfo(this,
+                                           stack->create_completion_notifier(),
+                                           store, bucket_info, exclusive,
+                                           mtime, attrs, dpp);
+    async_rados->queue(req);
+    return 0;
+  }
+  int request_complete() override {
+    return req->get_ret_status();
+  }
+};
+
 class RGWRadosBILogTrimCR : public RGWSimpleCoroutine {
   RGWRados::BucketShard bs;
   std::string start_marker;