]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librados_test_stub: add cls_cxx_replace
authorMykola Golub <mgolub@suse.com>
Fri, 8 Feb 2019 08:31:29 +0000 (08:31 +0000)
committerMykola Golub <mgolub@suse.com>
Fri, 15 Feb 2019 11:12:00 +0000 (11:12 +0000)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/test/librados_test_stub/LibradosTestStub.cc

index 78a290a3ac5e9d45040d45d1441cd080c4dcd5f9..f3cb4f864bc5a797e97ddb33cf7276475f1a89b7 100644 (file)
@@ -1366,6 +1366,17 @@ int cls_cxx_write_full(cls_method_context_t hctx, bufferlist *inbl) {
   return ctx->io_ctx_impl->write_full(ctx->oid, *inbl, ctx->snapc);
 }
 
+int cls_cxx_replace(cls_method_context_t hctx, int ofs, int len,
+                    bufferlist *inbl) {
+  librados::TestClassHandler::MethodContext *ctx =
+    reinterpret_cast<librados::TestClassHandler::MethodContext*>(hctx);
+  int r = ctx->io_ctx_impl->truncate(ctx->oid, 0, ctx->snapc);
+  if (r < 0) {
+    return r;
+  }
+  return ctx->io_ctx_impl->write(ctx->oid, *inbl, len, ofs, ctx->snapc);
+}
+
 int cls_cxx_list_watchers(cls_method_context_t hctx,
                          obj_list_watch_response_t *watchers) {
   librados::TestClassHandler::MethodContext *ctx =