]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add rgw_rados_notify() with optional_yield
authorCasey Bodley <cbodley@redhat.com>
Sat, 24 Nov 2018 00:28:08 +0000 (19:28 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 29 Mar 2019 15:12:49 +0000 (11:12 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h

index 11645dabb397728c8eba454cb15878bb5602173a..b39cfd446b1ab26a27d0d8fd3716bd61e821dc86 100644 (file)
@@ -171,6 +171,29 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
   return ioctx.operate(oid, op);
 }
 
+int rgw_rados_notify(librados::IoCtx& ioctx, const std::string& oid,
+                     bufferlist& bl, uint64_t timeout_ms, bufferlist* pbl,
+                     optional_yield y)
+{
+#ifdef HAVE_BOOST_CONTEXT
+  if (y) {
+    auto& context = y.get_io_context();
+    auto& yield = y.get_yield_context();
+    boost::system::error_code ec;
+    auto reply = librados::async_notify(context, ioctx, oid,
+                                        bl, timeout_ms, yield[ec]);
+    if (pbl) {
+      *pbl = std::move(reply);
+    }
+    return -ec.value();
+  }
+  if (is_asio_thread) {
+    dout(20) << "WARNING: blocking librados call" << dendl;
+  }
+#endif
+  return ioctx.notify2(oid, bl, timeout_ms, pbl);
+}
+
 void parse_mime_map_line(const char *start, const char *end)
 {
   char line[end - start + 1];
index b77e99c4f679a147cfc5915b8d2ab6004dc3da72..d7f3d50afd5519b174ab15b33105546b307539c2 100644 (file)
@@ -41,6 +41,9 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
                       optional_yield y);
 int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
                       librados::ObjectWriteOperation *op, optional_yield y);
+int rgw_rados_notify(librados::IoCtx& ioctx, const std::string& oid,
+                     bufferlist& bl, uint64_t timeout_ms, bufferlist* pbl,
+                     optional_yield y);
 
 int rgw_tools_init(CephContext *cct);
 void rgw_tools_cleanup();