]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/tools: add flags to rgw_rados_operate api 35172/head
authorYuval Lifshitz <ylifshit@redhat.com>
Thu, 21 May 2020 09:52:44 +0000 (12:52 +0300)
committerYuval Lifshitz <ylifshit@redhat.com>
Thu, 21 May 2020 10:48:52 +0000 (13:48 +0300)
currently flags are hardcoded to zero. this prevents some usecases, e.g.
passing OPERATION_RETURNVEC flag

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h

index b05fe0a0cc307c519fcf257042f7aa8159c6f7bf..af5e05cca64af9218e5336acef0c6713f82139ee 100644 (file)
@@ -248,7 +248,7 @@ thread_local bool is_asio_thread = false;
 
 int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
                       librados::ObjectReadOperation *op, bufferlist* pbl,
-                      optional_yield y)
+                      int flags, optional_yield y)
 {
 #ifdef HAVE_BOOST_CONTEXT
   // given a yield_context, call async_operate() to yield the coroutine instead
@@ -257,7 +257,7 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
     auto& context = y.get_io_context();
     auto& yield = y.get_yield_context();
     boost::system::error_code ec;
-    auto bl = librados::async_operate(context, ioctx, oid, op, 0, yield[ec]);
+    auto bl = librados::async_operate(context, ioctx, oid, op, flags, yield[ec]);
     if (pbl) {
       *pbl = std::move(bl);
     }
@@ -268,25 +268,38 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
     dout(20) << "WARNING: blocking librados call" << dendl;
   }
 #endif
-  return ioctx.operate(oid, op, nullptr);
+  return ioctx.operate(oid, op, nullptr, flags);
 }
 
 int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
-                      librados::ObjectWriteOperation *op, optional_yield y)
+                      librados::ObjectReadOperation *op, bufferlist* pbl,
+                      optional_yield y)
+{
+  return rgw_rados_operate(ioctx, oid, op, pbl, 0, y);
+}
+
+int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
+                      librados::ObjectWriteOperation *op, int flags, 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;
-    librados::async_operate(context, ioctx, oid, op, 0, yield[ec]);
+    librados::async_operate(context, ioctx, oid, op, flags, yield[ec]);
     return -ec.value();
   }
   if (is_asio_thread) {
     dout(20) << "WARNING: blocking librados call" << dendl;
   }
 #endif
-  return ioctx.operate(oid, op);
+  return ioctx.operate(oid, op, flags);
+}
+
+int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
+                      librados::ObjectWriteOperation *op, optional_yield y)
+{
+  return rgw_rados_operate(ioctx, oid, op, 0, y);
 }
 
 int rgw_rados_notify(librados::IoCtx& ioctx, const std::string& oid,
index 8c0065465465ea6fea4f450f0d1eb089b683213e..1fca1365bf4c2f9216db21ffcd05434df9bb414f 100644 (file)
@@ -95,8 +95,13 @@ extern thread_local bool is_asio_thread;
 int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
                       librados::ObjectReadOperation *op, bufferlist* pbl,
                       optional_yield y);
+int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
+                      librados::ObjectReadOperation *op, bufferlist* pbl,
+                      int flags, optional_yield y);
 int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
                       librados::ObjectWriteOperation *op, optional_yield y);
+int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
+                      librados::ObjectWriteOperation *op, int flags, 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);