]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/librados_test_stub/TestIoCtxImpl.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / test / librados_test_stub / TestIoCtxImpl.cc
index 31a60ae2621ffcecb58634e8e01128f77994ef42..73bc8d4a885364030b774dafc99c50ac9c06c003 100644 (file)
@@ -10,7 +10,7 @@
 #include "common/Finisher.h"
 #include "common/valgrind.h"
 #include "objclass/objclass.h"
-#include <boost/bind.hpp>
+#include <functional>
 #include <errno.h>
 
 namespace librados {
@@ -109,22 +109,24 @@ int TestIoCtxImpl::aio_operate(const std::string& oid, TestObjectOperationImpl &
   // TODO flags for now
   ops.get();
   m_pending_ops++;
-  m_client->add_aio_operation(oid, true, boost::bind(
+  m_client->add_aio_operation(oid, true, std::bind(
     &TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
-    reinterpret_cast<bufferlist*>(0),
-    snap_context != NULL ? *snap_context : m_snapc), c);
+    reinterpret_cast<bufferlist*>(0), m_snap_seq,
+    snap_context != NULL ? *snap_context : m_snapc, nullptr), c);
   return 0;
 }
 
 int TestIoCtxImpl::aio_operate_read(const std::string& oid,
                                     TestObjectOperationImpl &ops,
                                     AioCompletionImpl *c, int flags,
-                                    bufferlist *pbl) {
+                                    bufferlist *pbl, uint64_t snap_id,
+                                    uint64_t* objver) {
   // TODO ignoring flags for now
   ops.get();
   m_pending_ops++;
-  m_client->add_aio_operation(oid, true, boost::bind(
-    &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snapc), c);
+  m_client->add_aio_operation(oid, true, std::bind(
+    &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, snap_id,
+    m_snapc, objver), c);
   return 0;
 }
 
@@ -133,8 +135,8 @@ int TestIoCtxImpl::aio_watch(const std::string& o, AioCompletionImpl *c,
   m_pending_ops++;
   c->get();
   C_AioNotify *ctx = new C_AioNotify(this, c);
-  if (m_client->is_blacklisted()) {
-    m_client->get_aio_finisher()->queue(ctx, -EBLACKLISTED);
+  if (m_client->is_blocklisted()) {
+    m_client->get_aio_finisher()->queue(ctx, -EBLOCKLISTED);
   } else {
     m_client->get_watch_notify()->aio_watch(m_client, m_pool_id,
                                             get_namespace(), o,
@@ -148,8 +150,8 @@ int TestIoCtxImpl::aio_unwatch(uint64_t handle, AioCompletionImpl *c) {
   m_pending_ops++;
   c->get();
   C_AioNotify *ctx = new C_AioNotify(this, c);
-  if (m_client->is_blacklisted()) {
-    m_client->get_aio_finisher()->queue(ctx, -EBLACKLISTED);
+  if (m_client->is_blocklisted()) {
+    m_client->get_aio_finisher()->queue(ctx, -EBLOCKLISTED);
   } else {
     m_client->get_watch_notify()->aio_unwatch(m_client, handle, ctx);
   }
@@ -159,9 +161,9 @@ int TestIoCtxImpl::aio_unwatch(uint64_t handle, AioCompletionImpl *c) {
 int TestIoCtxImpl::exec(const std::string& oid, TestClassHandler *handler,
                         const char *cls, const char *method,
                         bufferlist& inbl, bufferlist* outbl,
-                        const SnapContext &snapc) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+                        uint64_t snap_id, const SnapContext &snapc) {
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   cls_method_cxx_call_t call = handler->get_method(cls, method);
@@ -170,13 +172,14 @@ int TestIoCtxImpl::exec(const std::string& oid, TestClassHandler *handler,
   }
 
   return (*call)(reinterpret_cast<cls_method_context_t>(
-    handler->get_method_context(this, oid, snapc).get()), &inbl, outbl);
+    handler->get_method_context(this, oid, snap_id, snapc).get()), &inbl,
+    outbl);
 }
 
 int TestIoCtxImpl::list_watchers(const std::string& o,
                                  std::list<obj_watch_t> *out_watchers) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   return m_client->get_watch_notify()->list_watchers(m_pool_id, get_namespace(),
@@ -185,8 +188,8 @@ int TestIoCtxImpl::list_watchers(const std::string& o,
 
 int TestIoCtxImpl::notify(const std::string& o, bufferlist& bl,
                           uint64_t timeout_ms, bufferlist *pbl) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   return m_client->get_watch_notify()->notify(m_client, m_pool_id,
@@ -201,14 +204,15 @@ void TestIoCtxImpl::notify_ack(const std::string& o, uint64_t notify_id,
                                            m_client->get_instance_id(), bl);
 }
 
-int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops) {
+int TestIoCtxImpl::operate(const std::string& oid,
+                           TestObjectOperationImpl &ops) {
   AioCompletionImpl *comp = new AioCompletionImpl();
 
   ops.get();
   m_pending_ops++;
-  m_client->add_aio_operation(oid, false, boost::bind(
+  m_client->add_aio_operation(oid, false, std::bind(
     &TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
-    reinterpret_cast<bufferlist*>(0), m_snapc), comp);
+    reinterpret_cast<bufferlist*>(0), m_snap_seq, m_snapc, nullptr), comp);
 
   comp->wait_for_complete();
   int ret = comp->get_return_value();
@@ -216,15 +220,16 @@ int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops)
   return ret;
 }
 
-int TestIoCtxImpl::operate_read(const std::string& oid, TestObjectOperationImpl &ops,
+int TestIoCtxImpl::operate_read(const std::string& oid,
+                                TestObjectOperationImpl &ops,
                                 bufferlist *pbl) {
   AioCompletionImpl *comp = new AioCompletionImpl();
 
   ops.get();
   m_pending_ops++;
-  m_client->add_aio_operation(oid, false, boost::bind(
+  m_client->add_aio_operation(oid, false, std::bind(
     &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl,
-    m_snapc), comp);
+    m_snap_seq, m_snapc, nullptr), comp);
 
   comp->wait_for_complete();
   int ret = comp->get_return_value();
@@ -236,14 +241,14 @@ void TestIoCtxImpl::aio_selfmanaged_snap_create(uint64_t *snapid,
                                                 AioCompletionImpl *c) {
   m_client->add_aio_operation(
     "", true,
-    boost::bind(&TestIoCtxImpl::selfmanaged_snap_create, this, snapid), c);
+    std::bind(&TestIoCtxImpl::selfmanaged_snap_create, this, snapid), c);
 }
 
 void TestIoCtxImpl::aio_selfmanaged_snap_remove(uint64_t snapid,
                                                 AioCompletionImpl *c) {
   m_client->add_aio_operation(
     "", true,
-    boost::bind(&TestIoCtxImpl::selfmanaged_snap_remove, this, snapid), c);
+    std::bind(&TestIoCtxImpl::selfmanaged_snap_remove, this, snapid), c);
 }
 
 int TestIoCtxImpl::selfmanaged_snap_set_write_ctx(snap_t seq,
@@ -269,8 +274,8 @@ void TestIoCtxImpl::set_snap_read(snap_t seq) {
 }
 
 int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   // TODO: protect against concurrent tmap updates
@@ -287,7 +292,7 @@ int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) {
 
   if (size > 0) {
     bufferlist inbl;
-    r = read(oid, size, 0, &inbl);
+    r = read(oid, size, 0, &inbl, CEPH_NOSNAP, nullptr);
     if (r < 0) {
       return r;
     }
@@ -326,8 +331,8 @@ int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) {
 }
 
 int TestIoCtxImpl::unwatch(uint64_t handle) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   return m_client->get_watch_notify()->unwatch(m_client, handle);
@@ -335,8 +340,8 @@ int TestIoCtxImpl::unwatch(uint64_t handle) {
 
 int TestIoCtxImpl::watch(const std::string& o, uint64_t *handle,
                          librados::WatchCtx *ctx, librados::WatchCtx2 *ctx2) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   return m_client->get_watch_notify()->watch(m_client, m_pool_id,
@@ -347,8 +352,8 @@ int TestIoCtxImpl::watch(const std::string& o, uint64_t *handle,
 
 int TestIoCtxImpl::execute_operation(const std::string& oid,
                                      const Operation &operation) {
-  if (m_client->is_blacklisted()) {
-    return -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    return -EBLOCKLISTED;
   }
 
   TestRadosClient::Transaction transaction(m_client, get_namespace(), oid);
@@ -357,16 +362,17 @@ int TestIoCtxImpl::execute_operation(const std::string& oid,
 
 int TestIoCtxImpl::execute_aio_operations(const std::string& oid,
                                           TestObjectOperationImpl *ops,
-                                          bufferlist *pbl,
-                                          const SnapContext &snapc) {
+                                          bufferlist *pbl, uint64_t snap_id,
+                                          const SnapContext &snapc,
+                                          uint64_t* objver) {
   int ret = 0;
-  if (m_client->is_blacklisted()) {
-    ret = -EBLACKLISTED;
+  if (m_client->is_blocklisted()) {
+    ret = -EBLOCKLISTED;
   } else {
     TestRadosClient::Transaction transaction(m_client, get_namespace(), oid);
     for (ObjectOperations::iterator it = ops->ops.begin();
          it != ops->ops.end(); ++it) {
-      ret = (*it)(this, oid, pbl, snapc);
+      ret = (*it)(this, oid, pbl, snap_id, snapc, objver);
       if (ret < 0) {
         break;
       }