summaryrefslogtreecommitdiffstats
path: root/src/cls/cas/cls_cas_ops.h
diff options
context:
space:
mode:
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