]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls: add timeindex types to ceph-dencoder
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 22 Jul 2019 14:40:23 +0000 (16:40 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 22 Jul 2019 15:41:11 +0000 (17:41 +0200)
This is useful for seeing on disk format of types using cls_timeindex like rgw
swift with delete at attributes

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/cls/CMakeLists.txt
src/cls/timeindex/cls_timeindex_types.cc [new file with mode: 0644]
src/cls/timeindex/cls_timeindex_types.h
src/tools/ceph-dencoder/common_types.h

index d62273d4c4a24418564287e49d3223e2492593ab..127af83881b59484ab060528b49de6e6b7bc61e0 100644 (file)
@@ -148,7 +148,9 @@ set_target_properties(cls_timeindex PROPERTIES
   CXX_VISIBILITY_PRESET hidden)
 install(TARGETS cls_timeindex DESTINATION ${cls_dir})
 
-set(cls_timeindex_client_srcs timeindex/cls_timeindex_client.cc)
+set(cls_timeindex_client_srcs
+  timeindex/cls_timeindex_types.cc
+  timeindex/cls_timeindex_client.cc)
 add_library(cls_timeindex_client STATIC ${cls_timeindex_client_srcs})
 
 
diff --git a/src/cls/timeindex/cls_timeindex_types.cc b/src/cls/timeindex/cls_timeindex_types.cc
new file mode 100644 (file)
index 0000000..98c3741
--- /dev/null
@@ -0,0 +1,21 @@
+#include "cls_timeindex_types.h"
+#include "common/Formatter.h"
+
+void cls_timeindex_entry::dump(Formatter *f) const
+{
+  f->dump_stream("key_ts") << key_ts;
+  f->dump_string("key_ext", key_ext);
+  f->dump_string("value", value.to_str());
+}
+
+void cls_timeindex_entry::generate_test_instances(list<cls_timeindex_entry*>& o)
+{
+  cls_timeindex_entry *i = new cls_timeindex_entry;
+  i->key_ts = utime_t(0,0);
+  i->key_ext = "foo";
+  bufferlist bl;
+  bl.append("bar");
+  i->value = bl;
+  o.push_back(i);
+  o.push_back(new cls_timeindex_entry);
+}
index 2b381767cf62ad665c19c227bd199716df3a21e0..90ac3b8e55d0bf5f658ecce1a2414142b3e935c8 100644 (file)
@@ -37,6 +37,9 @@ struct cls_timeindex_entry {
     decode(value, bl);
     DECODE_FINISH(bl);
   }
+
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<cls_timeindex_entry*>& o);
 };
 WRITE_CLASS_ENCODER(cls_timeindex_entry)
 
index 402943ad6429e85be6a7286faa39e481c653ab7e..3cf9e2d18bb3e4a049fcec2f297fe050abf2b2f6 100644 (file)
@@ -84,6 +84,9 @@ TYPE(cls_refcount_read_op)
 TYPE(cls_refcount_read_ret)
 TYPE(obj_refcount)
 
+#include "cls/timeindex/cls_timeindex_types.h"
+TYPE(cls_timeindex_entry)
+
 #include "journal/Entry.h"
 TYPE(journal::Entry)