summaryrefslogtreecommitdiffstats
path: root/src/cls/cas/cls_cas_ops.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/cls/cas/cls_cas_ops.h
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cls/cas/cls_cas_ops.h')
-rw-r--r--src/cls/cas/cls_cas_ops.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/cls/cas/cls_cas_ops.h b/src/cls/cas/cls_cas_ops.h
new file mode 100644
index 000000000..a79013f0e
--- /dev/null
+++ b/src/cls/cas/cls_cas_ops.h
@@ -0,0 +1,101 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_CLS_CAS_OPS_H
+#define CEPH_CLS_CAS_OPS_H
+
+#include "include/types.h"
+#include "common/hobject.h"
+#include "common/Formatter.h"
+
+struct cls_cas_chunk_create_or_get_ref_op {
+ enum {
+ FLAG_VERIFY = 1, // verify content bit-for-bit if chunk already exists
+ };
+
+ hobject_t source;
+ uint64_t flags = 0;
+ bufferlist data;
+
+ cls_cas_chunk_create_or_get_ref_op() {}
+
+ void encode(ceph::buffer::list& bl) const {
+ ENCODE_START(1, 1, bl);
+ encode(source, bl);
+ encode(flags, bl);
+ encode(data, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(ceph::buffer::list::const_iterator& bl) {
+ DECODE_START(1, bl);
+ decode(source, bl);
+ decode(flags, bl);
+ decode(data, bl);
+ DECODE_FINISH(bl);
+ }
+ void dump(ceph::Formatter *f) const {
+ f->dump_object("source", source);
+ f->dump_unsigned("flags", flags);
+ f->dump_unsigned("data_len", data.length());
+ }
+ static void generate_test_instances(std::list<cls_cas_chunk_create_or_get_ref_op*>& ls) {
+ ls.push_back(new cls_cas_chunk_create_or_get_ref_op());
+ }
+};
+WRITE_CLASS_ENCODER(cls_cas_chunk_create_or_get_ref_op)
+
+
+struct cls_cas_chunk_get_ref_op {
+ hobject_t source;
+
+ cls_cas_chunk_get_ref_op() {}
+
+ void encode(ceph::buffer::list& bl) const {
+ ENCODE_START(1, 1, bl);
+ encode(source, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(ceph::buffer::list::const_iterator& bl) {
+ DECODE_START(1, bl);
+ decode(source, bl);
+ DECODE_FINISH(bl);
+ }
+ void dump(ceph::Formatter *f) const {
+ f->dump_object("source", source);
+ }
+ static void generate_test_instances(std::list<cls_cas_chunk_get_ref_op*>& ls) {
+ ls.push_back(new cls_cas_chunk_get_ref_op());
+ }
+};
+WRITE_CLASS_ENCODER(cls_cas_chunk_get_ref_op)
+
+
+struct cls_cas_chunk_put_ref_op {
+ hobject_t source;
+
+ cls_cas_chunk_put_ref_op() {}
+
+ void encode(ceph::buffer::list& bl) const {
+ ENCODE_START(1, 1, bl);
+ encode(source, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(ceph::buffer::list::const_iterator& bl) {
+ DECODE_START(1, bl);
+ decode(source, bl);
+ DECODE_FINISH(bl);
+ }
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_object("source", source);
+ }
+ static void generate_test_instances(std::list<cls_cas_chunk_put_ref_op*>& ls) {
+ ls.push_back(new cls_cas_chunk_put_ref_op());
+ }
+};
+WRITE_CLASS_ENCODER(cls_cas_chunk_put_ref_op)
+
+#endif