summaryrefslogtreecommitdiffstats
path: root/src/cls/cas/cls_cas_client.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/cls/cas/cls_cas_client.cc
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cls/cas/cls_cas_client.cc')
-rw-r--r--src/cls/cas/cls_cas_client.cc65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/cls/cas/cls_cas_client.cc b/src/cls/cas/cls_cas_client.cc
new file mode 100644
index 000000000..085d9e52a
--- /dev/null
+++ b/src/cls/cas/cls_cas_client.cc
@@ -0,0 +1,65 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include <errno.h>
+
+#include "cls/cas/cls_cas_client.h"
+#include "cls/cas/cls_cas_ops.h"
+#include "include/rados/librados.hpp"
+
+using std::set;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
+void cls_cas_chunk_create_or_get_ref(
+ librados::ObjectWriteOperation& op,
+ const hobject_t& soid,
+ const bufferlist& data,
+ bool verify)
+{
+ bufferlist in;
+ cls_cas_chunk_create_or_get_ref_op call;
+ call.source = soid;
+ if (verify) {
+ call.flags |= cls_cas_chunk_create_or_get_ref_op::FLAG_VERIFY;
+ }
+ call.data = data;
+ encode(call, in);
+ op.exec("cas", "chunk_create_or_get_ref", in);
+}
+
+void cls_cas_chunk_get_ref(
+ librados::ObjectWriteOperation& op,
+ const hobject_t& soid)
+{
+ bufferlist in;
+ cls_cas_chunk_get_ref_op call;
+ call.source = soid;
+ encode(call, in);
+ op.exec("cas", "chunk_get_ref", in);
+}
+
+void cls_cas_chunk_put_ref(
+ librados::ObjectWriteOperation& op,
+ const hobject_t& soid)
+{
+ bufferlist in;
+ cls_cas_chunk_put_ref_op call;
+ call.source = soid;
+ encode(call, in);
+ op.exec("cas", "chunk_put_ref", in);
+}
+
+int cls_cas_references_chunk(
+ librados::IoCtx& io_ctx,
+ const string& oid,
+ const string& chunk_oid)
+{
+ bufferlist in, out;
+ encode(chunk_oid, in);
+ int r = io_ctx.exec(oid, "cas", "references_chunk", in, out);
+ return r;
+}