summaryrefslogtreecommitdiffstats
path: root/src/cls/timeindex
diff options
context:
space:
mode:
Diffstat (limited to 'src/cls/timeindex')
-rw-r--r--src/cls/timeindex/cls_timeindex_ops.h38
-rw-r--r--src/cls/timeindex/cls_timeindex_types.h2
2 files changed, 39 insertions, 1 deletions
diff --git a/src/cls/timeindex/cls_timeindex_ops.h b/src/cls/timeindex/cls_timeindex_ops.h
index f40058954dc..f0f0cc02475 100644
--- a/src/cls/timeindex/cls_timeindex_ops.h
+++ b/src/cls/timeindex/cls_timeindex_ops.h
@@ -4,6 +4,7 @@
#ifndef CEPH_CLS_TIMEINDEX_OPS_H
#define CEPH_CLS_TIMEINDEX_OPS_H
+#include "common/ceph_json.h"
#include "cls_timeindex_types.h"
struct cls_timeindex_add_op {
@@ -51,6 +52,26 @@ struct cls_timeindex_list_op {
decode(max_entries, bl);
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ f->open_object_section("from_time");
+ from_time.dump(f);
+ f->close_section();
+ f->dump_string("marker", marker);
+ f->open_object_section("to_time");
+ to_time.dump(f);
+ f->close_section();
+ f->dump_int("max_entries", max_entries);
+ }
+
+ static void generate_test_instances(std::list<cls_timeindex_list_op*>& o) {
+ o.push_back(new cls_timeindex_list_op);
+ o.push_back(new cls_timeindex_list_op);
+ o.back()->from_time = utime_t(1, 2);
+ o.back()->marker = "marker";
+ o.back()->to_time = utime_t(3, 4);
+ o.back()->max_entries = 5;
+ }
};
WRITE_CLASS_ENCODER(cls_timeindex_list_op)
@@ -76,6 +97,23 @@ struct cls_timeindex_list_ret {
decode(truncated, bl);
DECODE_FINISH(bl);
}
+
+ void dump(ceph::Formatter *f) const {
+ encode_json("entries", entries, f);
+ f->dump_string("marker", marker);
+ f->dump_bool("truncated", truncated);
+ }
+
+ static void generate_test_instances(std::list<cls_timeindex_list_ret*>& o) {
+ o.push_back(new cls_timeindex_list_ret);
+ o.push_back(new cls_timeindex_list_ret);
+ o.back()->entries.push_back(cls_timeindex_entry());
+ o.back()->entries.back().key_ts = utime_t(1, 2);
+ o.back()->entries.back().key_ext = "key_ext";
+ o.back()->entries.back().value.append("value");
+ o.back()->marker = "marker";
+ o.back()->truncated = true;
+ }
};
WRITE_CLASS_ENCODER(cls_timeindex_list_ret)
diff --git a/src/cls/timeindex/cls_timeindex_types.h b/src/cls/timeindex/cls_timeindex_types.h
index d33886881be..ea8d6c93d2c 100644
--- a/src/cls/timeindex/cls_timeindex_types.h
+++ b/src/cls/timeindex/cls_timeindex_types.h
@@ -4,9 +4,9 @@
#ifndef CEPH_CLS_TIMEINDEX_TYPES_H
#define CEPH_CLS_TIMEINDEX_TYPES_H
+#include "common/Formatter.h"
#include "include/encoding.h"
#include "include/types.h"
-
#include "include/utime.h"
class JSONObj;