summaryrefslogtreecommitdiffstats
path: root/src/cls/queue/cls_queue_ops.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cls/queue/cls_queue_ops.h')
-rw-r--r--src/cls/queue/cls_queue_ops.h74
1 files changed, 72 insertions, 2 deletions
diff --git a/src/cls/queue/cls_queue_ops.h b/src/cls/queue/cls_queue_ops.h
index f41572036c5..25bf1200c54 100644
--- a/src/cls/queue/cls_queue_ops.h
+++ b/src/cls/queue/cls_queue_ops.h
@@ -4,6 +4,7 @@
#ifndef CEPH_CLS_QUEUE_OPS_H
#define CEPH_CLS_QUEUE_OPS_H
+#include "common/ceph_json.h"
#include "cls/queue/cls_queue_types.h"
struct cls_queue_init_op {
@@ -29,6 +30,19 @@ struct cls_queue_init_op {
DECODE_FINISH(bl);
}
+ void dump(ceph::Formatter *f) const {
+ f->dump_unsigned("queue_size", queue_size);
+ f->dump_unsigned("max_urgent_data_size", max_urgent_data_size);
+ f->dump_unsigned("urgent_data_len", bl_urgent_data.length());
+ }
+
+ static void generate_test_instances(std::list<cls_queue_init_op*>& o) {
+ o.push_back(new cls_queue_init_op);
+ o.push_back(new cls_queue_init_op);
+ o.back()->queue_size = 1024;
+ o.back()->max_urgent_data_size = 1024;
+ o.back()->bl_urgent_data.append(std::string_view("data"));
+ }
};
WRITE_CLASS_ENCODER(cls_queue_init_op)
@@ -47,12 +61,23 @@ struct cls_queue_enqueue_op {
DECODE_START(1, bl);
decode(bl_data_vec, bl);
DECODE_FINISH(bl);
- }
+ }
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_unsigned("data_vec_len", bl_data_vec.size());
+ }
+
+ static void generate_test_instances(std::list<cls_queue_enqueue_op*>& o) {
+ o.push_back(new cls_queue_enqueue_op);
+ o.push_back(new cls_queue_enqueue_op);
+ o.back()->bl_data_vec.push_back(ceph::buffer::list());
+ o.back()->bl_data_vec.back().append(std::string_view("data"));
+ }
};
WRITE_CLASS_ENCODER(cls_queue_enqueue_op)
struct cls_queue_list_op {
- uint64_t max;
+ uint64_t max{0};
std::string start_marker;
std::string end_marker;
@@ -75,6 +100,18 @@ struct cls_queue_list_op {
}
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_unsigned("max", max);
+ f->dump_string("start_marker", start_marker);
+ }
+
+ static void generate_test_instances(std::list<cls_queue_list_op*>& o) {
+ o.push_back(new cls_queue_list_op);
+ o.push_back(new cls_queue_list_op);
+ o.back()->max = 123;
+ o.back()->start_marker = "foo";
+ }
};
WRITE_CLASS_ENCODER(cls_queue_list_op)
@@ -100,6 +137,22 @@ struct cls_queue_list_ret {
decode(entries, bl);
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_bool("is_truncated", is_truncated);
+ f->dump_string("next_marker", next_marker);
+ encode_json("entries", entries, f);
+ }
+
+ static void generate_test_instances(std::list<cls_queue_list_ret*>& o) {
+ o.push_back(new cls_queue_list_ret);
+ o.back()->is_truncated = true;
+ o.back()->next_marker = "foo";
+ o.back()->entries.push_back(cls_queue_entry());
+ o.back()->entries.push_back(cls_queue_entry());
+ o.back()->entries.back().marker = "id";
+ o.back()->entries.back().data.append(std::string_view("data"));
+ }
};
WRITE_CLASS_ENCODER(cls_queue_list_ret)
@@ -119,6 +172,15 @@ struct cls_queue_remove_op {
decode(end_marker, bl);
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_string("end_marker", end_marker);
+ }
+ static void generate_test_instances(std::list<cls_queue_remove_op*>& o) {
+ o.push_back(new cls_queue_remove_op);
+ o.push_back(new cls_queue_remove_op);
+ o.back()->end_marker = "foo";
+ }
};
WRITE_CLASS_ENCODER(cls_queue_remove_op)
@@ -138,6 +200,14 @@ struct cls_queue_get_capacity_ret {
decode(queue_capacity, bl);
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ f->dump_unsigned("queue_capacity", queue_capacity);
+ }
+ static void generate_test_instances(std::list<cls_queue_get_capacity_ret*>& o) {
+ o.push_back(new cls_queue_get_capacity_ret);
+ o.back()->queue_capacity = 123;
+ }
};
WRITE_CLASS_ENCODER(cls_queue_get_capacity_ret)