]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: introduce RGWRadosNotifyCR for aio_notify
authorCasey Bodley <cbodley@redhat.com>
Wed, 30 Aug 2017 20:19:36 +0000 (16:19 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 22 Jan 2018 22:00:33 +0000 (17:00 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 964d966969bf757570bffb650ebb4ef515a6592e)

src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index fabf387e70f3b7a6077b27aea40299e58db87fd7..002220f2e421cdbc9f7d9207fa920ad3254b8408 100644 (file)
@@ -794,3 +794,36 @@ int RGWStatObjCR::request_complete()
 {
   return req->get_ret_status();
 }
+
+RGWRadosNotifyCR::RGWRadosNotifyCR(RGWRados *store, const rgw_raw_obj& obj,
+                                   bufferlist& request, uint64_t timeout_ms,
+                                   bufferlist *response)
+  : RGWSimpleCoroutine(store->ctx()), store(store), obj(obj),
+    request(request), timeout_ms(timeout_ms), response(response)
+{
+  set_description() << "notify dest=" << obj;
+}
+
+int RGWRadosNotifyCR::send_request()
+{
+  int r = store->get_raw_obj_ref(obj, &ref);
+  if (r < 0) {
+    lderr(store->ctx()) << "ERROR: failed to get ref for (" << obj << ") ret=" << r << dendl;
+    return r;
+  }
+
+  set_status() << "sending request";
+
+  cn = stack->create_completion_notifier();
+  return ref.ioctx.aio_notify(ref.oid, cn->completion(), request,
+                              timeout_ms, response);
+}
+
+int RGWRadosNotifyCR::request_complete()
+{
+  int r = cn->completion()->get_return_value();
+
+  set_status() << "request complete; ret=" << r;
+
+  return r;
+}
index a82bb35b5fce8fc5e7b7a08e866ca6bed74364db..144ffbc0bf2494d73c056e694035a27b5060f256 100644 (file)
@@ -1154,4 +1154,23 @@ class RGWStatObjCR : public RGWSimpleCoroutine {
   int request_complete() override;
 };
 
+/// coroutine wrapper for IoCtx::aio_notify()
+class RGWRadosNotifyCR : public RGWSimpleCoroutine {
+  RGWRados *const store;
+  const rgw_raw_obj obj;
+  bufferlist request;
+  const uint64_t timeout_ms;
+  bufferlist *response;
+  rgw_rados_ref ref;
+  boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
+
+public:
+  RGWRadosNotifyCR(RGWRados *store, const rgw_raw_obj& obj,
+                   bufferlist& request, uint64_t timeout_ms,
+                   bufferlist *response);
+
+  int send_request() override;
+  int request_complete() override;
+};
+
 #endif