]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rgw: implement dump() and generate test instances
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Nov 2014 05:46:42 +0000 (21:46 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 19 Jan 2015 23:57:51 +0000 (15:57 -0800)
Add missing methods for some cls_rgw op types.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw_ops.cc
src/cls/rgw/cls_rgw_ops.h
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h

index d3c0b940ddac49dd40651a86d9b609d0b22cedce..e6bbbf2957ce1ab0c3096fb362e26ab6f0c1950b 100644 (file)
@@ -142,6 +142,107 @@ void rgw_cls_obj_complete_op::dump(Formatter *f) const
   f->dump_string("tag", tag);
 }
 
+void rgw_cls_link_olh_op::generate_test_instances(list<rgw_cls_link_olh_op*>& o)
+{
+  rgw_cls_link_olh_op *op = new rgw_cls_link_olh_op;
+  op->key.name = "name";
+  op->olh_tag = "olh_tag";
+  op->delete_marker = true;
+  op->op_tag = "op_tag";
+  list<rgw_bucket_dir_entry_meta *> l;
+  rgw_bucket_dir_entry_meta::generate_test_instances(l);
+  list<rgw_bucket_dir_entry_meta *>::iterator iter = l.begin();
+  op->meta = *(*iter);
+
+  o.push_back(op);
+
+  o.push_back(new rgw_cls_link_olh_op);
+}
+
+void rgw_cls_link_olh_op::dump(Formatter *f) const
+{
+  ::encode_json("key", key, f);
+  ::encode_json("olh_tag", olh_tag, f);
+  ::encode_json("delete_marker", delete_marker, f);
+  ::encode_json("op_tag", op_tag, f);
+  ::encode_json("meta", meta, f);
+}
+
+void rgw_cls_unlink_instance_op::generate_test_instances(list<rgw_cls_unlink_instance_op*>& o)
+{
+  rgw_cls_unlink_instance_op *op = new rgw_cls_unlink_instance_op;
+  op->key.name = "name";
+  op->op_tag = "op_tag";
+
+  o.push_back(op);
+
+  o.push_back(new rgw_cls_unlink_instance_op);
+}
+
+void rgw_cls_unlink_instance_op::dump(Formatter *f) const
+{
+  ::encode_json("key", key, f);
+  ::encode_json("op_tag", op_tag, f);
+}
+
+void rgw_cls_read_olh_log_op::generate_test_instances(list<rgw_cls_read_olh_log_op*>& o)
+{
+  rgw_cls_read_olh_log_op *op = new rgw_cls_read_olh_log_op;
+  op->olh.name = "name";
+  op->ver_marker = 123;
+  op->olh_tag = "olh_tag";
+
+  o.push_back(op);
+
+  o.push_back(new rgw_cls_read_olh_log_op);
+}
+
+void rgw_cls_read_olh_log_op::dump(Formatter *f) const
+{
+  ::encode_json("olh", olh, f);
+  ::encode_json("ver_marker", ver_marker, f);
+  ::encode_json("olh_tag", olh_tag, f);
+}
+
+void rgw_cls_read_olh_log_ret::generate_test_instances(list<rgw_cls_read_olh_log_ret*>& o)
+{
+  rgw_cls_read_olh_log_ret *r = new rgw_cls_read_olh_log_ret;
+  r->is_truncated = true;
+  list<rgw_bucket_olh_log_entry *> l;
+  rgw_bucket_olh_log_entry::generate_test_instances(l);
+  list<rgw_bucket_olh_log_entry *>::iterator iter = l.begin();
+  r->log[1] = *(*iter);
+
+  o.push_back(r);
+
+  o.push_back(new rgw_cls_read_olh_log_ret);
+}
+
+void rgw_cls_read_olh_log_ret::dump(Formatter *f) const
+{
+  ::encode_json("log", log, f);
+  ::encode_json("is_truncated", is_truncated, f);
+}
+
+void rgw_cls_trim_olh_log_op::generate_test_instances(list<rgw_cls_trim_olh_log_op*>& o)
+{
+  rgw_cls_trim_olh_log_op *op = new rgw_cls_trim_olh_log_op;
+  op->olh.name = "olh.name";
+  op->ver = 100;
+  op->olh_tag = "olh_tag";
+
+  o.push_back(op);
+
+  o.push_back(new rgw_cls_trim_olh_log_op);
+}
+
+void rgw_cls_trim_olh_log_op::dump(Formatter *f) const
+{
+  ::encode_json("olh", olh, f);
+  ::encode_json("ver", ver, f);
+  ::encode_json("olh_tag", olh_tag, f);
+}
+
 void rgw_cls_list_op::generate_test_instances(list<rgw_cls_list_op*>& o)
 {
   rgw_cls_list_op *op = new rgw_cls_list_op;
index 5900dab6996efd0dbec9eb4199af2bc743ed3466..c11a943de615449e77a23910e4add834938ec7f4 100644 (file)
@@ -174,8 +174,8 @@ struct rgw_cls_link_olh_op {
     DECODE_FINISH(bl);
   }
 
+  static void generate_test_instances(list<rgw_cls_link_olh_op *>& o);
   void dump(Formatter *f) const;
-#warning implement me
 };
 WRITE_CLASS_ENCODER(rgw_cls_link_olh_op)
 
@@ -199,8 +199,8 @@ struct rgw_cls_unlink_instance_op {
     DECODE_FINISH(bl);
   }
 
+  static void generate_test_instances(list<rgw_cls_unlink_instance_op *>& o);
   void dump(Formatter *f) const;
-#warning implement me
 };
 WRITE_CLASS_ENCODER(rgw_cls_unlink_instance_op)
 
@@ -226,8 +226,8 @@ struct rgw_cls_read_olh_log_op
     ::decode(olh_tag, bl);
     DECODE_FINISH(bl);
   }
+  static void generate_test_instances(list<rgw_cls_read_olh_log_op *>& o);
   void dump(Formatter *f) const;
-#warning implement me
 };
 WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_op)
 
@@ -251,8 +251,8 @@ struct rgw_cls_read_olh_log_ret
     ::decode(is_truncated, bl);
     DECODE_FINISH(bl);
   }
+  static void generate_test_instances(list<rgw_cls_read_olh_log_ret *>& o);
   void dump(Formatter *f) const;
-#warning implement me
 };
 WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_ret)
 
@@ -278,8 +278,8 @@ struct rgw_cls_trim_olh_log_op
     ::decode(olh_tag, bl);
     DECODE_FINISH(bl);
   }
+  static void generate_test_instances(list<rgw_cls_trim_olh_log_op *>& o);
   void dump(Formatter *f) const;
-#warning implement me
 };
 WRITE_CLASS_ENCODER(rgw_cls_trim_olh_log_op)
 
index 74469bc6f83f04498ffecc53363e756f59f5f12b..89d171d687c0624710de93e7c83bedd7129bee22 100644 (file)
@@ -232,6 +232,18 @@ void rgw_bucket_olh_entry::dump(Formatter *f) const
   encode_json("exists", exists, f);
 }
 
+void rgw_bucket_olh_log_entry::generate_test_instances(list<rgw_bucket_olh_log_entry*>& o)
+{
+  rgw_bucket_olh_log_entry *entry = new rgw_bucket_olh_log_entry;
+  entry->epoch = 1234;
+  entry->op = CLS_RGW_OLH_OP_LINK_OLH;
+  entry->op_tag = "op_tag";
+  entry->key.name = "key.name";
+  entry->key.instance = "key.instance";
+  entry->delete_marker = true;
+  o.push_back(new rgw_bucket_olh_log_entry);
+}
+
 void rgw_bucket_olh_log_entry::dump(Formatter *f) const
 {
   encode_json("epoch", epoch, f);
index 923c59c620b854b31040cf59ff67ebf27a562898..7438147dc9187d36a762c625c0f04764dc37304b 100644 (file)
@@ -402,6 +402,7 @@ struct rgw_bucket_olh_log_entry {
     ::decode(delete_marker, bl);
     DECODE_FINISH(bl);
   }
+  static void generate_test_instances(list<rgw_bucket_olh_log_entry*>& o);
   void dump(Formatter *f) const;
 };
 WRITE_CLASS_ENCODER(rgw_bucket_olh_log_entry)