]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Missing functions and TYPES of cls_rgw_types.h are added 45394/head
authorIqbal Khan <iqkhan@redhat.com>
Tue, 15 Mar 2022 15:16:28 +0000 (20:46 +0530)
committerIqbal Khan <iqkhan@redhat.com>
Thu, 7 Apr 2022 08:14:20 +0000 (13:44 +0530)
Fixes: https://tracker.ceph.com/issues/54054
Signed-off-by: Iqbal Khan <iqkhan@redhat.com>
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h
src/tools/ceph-dencoder/rgw_types.h

index aef3aab6da4378de6560e3393cc5f92192556e0d..75be340b6a9784ebe6fcda8a511d89e88319cdfe 100644 (file)
@@ -404,6 +404,24 @@ bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key *key,
 
   return account;
 }
+void rgw_cls_bi_entry::generate_test_instances(list<rgw_cls_bi_entry*>& o)
+{
+  using ceph::encode;
+  rgw_cls_bi_entry *m = new rgw_cls_bi_entry;
+  rgw_bucket_olh_entry entry;
+  entry.delete_marker = true;
+  entry.epoch = 1234;
+  entry.tag = "tag";
+  entry.key.name = "key.name";
+  entry.key.instance = "key.instance";
+  entry.exists = true;
+  entry.pending_removal = true;
+  m->type = BIIndexType::OLH;
+  m->idx = "idx";
+  encode(entry,m->data);
+  o.push_back(m);
+  o.push_back(new rgw_cls_bi_entry);
+}
 
 void rgw_bucket_olh_entry::dump(Formatter *f) const
 {
@@ -427,6 +445,20 @@ void rgw_bucket_olh_entry::decode_json(JSONObj *obj)
   JSONDecoder::decode_json("pending_removal", pending_removal, obj);
 }
 
+void rgw_bucket_olh_entry::generate_test_instances(list<rgw_bucket_olh_entry*>& o)
+{
+  rgw_bucket_olh_entry *entry = new rgw_bucket_olh_entry;
+  entry->delete_marker = true;
+  entry->epoch = 1234;
+  entry->tag = "tag";
+  entry->key.name = "key.name";
+  entry->key.instance = "key.instance";
+  entry->exists = true;
+  entry->pending_removal = true;
+  o.push_back(entry);
+  o.push_back(new rgw_bucket_olh_entry);
+}
+
 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;
@@ -655,6 +687,58 @@ void rgw_bucket_dir::dump(Formatter *f) const
   f->close_section();
 }
 
+void rgw_usage_data::generate_test_instances(list<rgw_usage_data*>& o)
+{
+  rgw_usage_data *s = new rgw_usage_data;
+  s->bytes_sent = 1024;
+  s->bytes_received = 1024;
+  s->ops = 2;
+  s->successful_ops = 1;
+  o.push_back(s);
+  o.push_back(new rgw_usage_data);
+}
+
+void rgw_usage_data::dump(Formatter *f) const
+{
+  f->dump_int("bytes_sent", bytes_sent);
+  f->dump_int("bytes_received", bytes_received);
+  f->dump_int("ops", ops);
+  f->dump_int("successful_ops", successful_ops);
+}
+
+void rgw_usage_log_info::generate_test_instances(list<rgw_usage_log_info*>& o)
+{
+  rgw_usage_log_info *s = new rgw_usage_log_info;
+  std::string owner = "owner";
+  std::string payer = "payer";
+  std::string bucket = "bucket";
+
+  rgw_usage_log_entry r(owner, payer, bucket);
+  s->entries.push_back(r);
+  o.push_back(s);
+  o.push_back(new rgw_usage_log_info);
+}
+
+void rgw_usage_log_info::dump(Formatter *f) const
+{
+  encode_json("entries", entries, f);
+}
+
+void rgw_user_bucket::generate_test_instances(list<rgw_user_bucket*>& o)
+{
+  rgw_user_bucket *s = new rgw_user_bucket;
+  s->user = "user";
+  s->bucket = "bucket";
+  o.push_back(s);
+  o.push_back(new rgw_user_bucket);
+}
+
+void rgw_user_bucket::dump(Formatter *f) const
+{
+  f->dump_string("user", user);
+  f->dump_string("bucket", bucket);
+}
+
 void rgw_usage_log_entry::dump(Formatter *f) const
 {
   f->dump_string("owner", owner.to_str());
@@ -746,7 +830,7 @@ void cls_rgw_bucket_instance_entry::dump(Formatter *f) const
 }
 
 void cls_rgw_bucket_instance_entry::generate_test_instances(
-  list<cls_rgw_bucket_instance_entry*>& ls)
+list<cls_rgw_bucket_instance_entry*>& ls)
 {
   ls.push_back(new cls_rgw_bucket_instance_entry);
   ls.push_back(new cls_rgw_bucket_instance_entry);
@@ -761,8 +845,14 @@ void cls_rgw_lc_entry::dump(Formatter *f) const
   encode_json("status", status, f);
 }
 
-void generate_test_instances(list<cls_rgw_lc_entry*>& ls)
+void cls_rgw_lc_entry::generate_test_instances(list<cls_rgw_lc_entry*>& o)
 {
+  cls_rgw_lc_entry *s = new cls_rgw_lc_entry;
+  s->bucket = "bucket";
+  s->start_time = 10;
+  s->status = 1;
+  o.push_back(s);
+  o.push_back(new cls_rgw_lc_entry);
 }
 
 void cls_rgw_lc_obj_head::dump(Formatter *f) const 
index 9a9626af99a9b2647326b667670fe8e3afd5ee51..063d3ea488218930e5156db5c2c2b0d696564d07 100644 (file)
@@ -567,7 +567,7 @@ struct rgw_cls_bi_entry {
 
   void dump(ceph::Formatter *f) const;
   void decode_json(JSONObj *obj, cls_rgw_obj_key *effective_key = NULL);
-
+  static void generate_test_instances(std::list<rgw_cls_bi_entry*>& o);
   bool get_info(cls_rgw_obj_key *key, RGWObjCategory *category,
                rgw_bucket_category_stats *accounted_stats);
 };
@@ -651,6 +651,7 @@ struct rgw_bucket_olh_entry {
   }
   void dump(ceph::Formatter *f) const;
   void decode_json(JSONObj *obj);
+  static void generate_test_instances(std::list<rgw_bucket_olh_entry*>& o);
 };
 WRITE_CLASS_ENCODER(rgw_bucket_olh_entry)
 
@@ -957,6 +958,8 @@ struct rgw_usage_data {
     ops += usage.ops;
     successful_ops += usage.successful_ops;
   }
+  void dump(ceph::Formatter *f) const;
+  static void generate_test_instances(std::list<rgw_usage_data*>& o);
 };
 WRITE_CLASS_ENCODER(rgw_usage_data)
 
@@ -1063,6 +1066,8 @@ struct rgw_usage_log_info {
     decode(entries, bl);
     DECODE_FINISH(bl);
   }
+  void dump(ceph::Formatter* f) const;
+  static void generate_test_instances(std::list<rgw_usage_log_info*>& o);
 
   rgw_usage_log_info() {}
 };
@@ -1098,6 +1103,8 @@ struct rgw_user_bucket {
 
     return false;
   }
+  void dump(ceph::Formatter* f) const;
+  static void generate_test_instances(std::list<rgw_user_bucket*>& o);
 };
 WRITE_CLASS_ENCODER(rgw_user_bucket)
 
@@ -1293,7 +1300,7 @@ struct cls_rgw_lc_entry {
     DECODE_FINISH(bl);
   }
   void dump(Formatter *f) const;
-  void generate_test_instances(std::list<cls_rgw_lc_entry*>& ls);
+  static void generate_test_instances(std::list<cls_rgw_lc_entry*>& ls);
 };
 WRITE_CLASS_ENCODER(cls_rgw_lc_entry);
 
index 879a1dc789de6b8a43f155f5becb911b2a8bfa84..f7d473083d4f6973367e7a9ea15ae0dc08a9e402 100644 (file)
@@ -42,6 +42,12 @@ TYPE(rgw_bucket_entry_ver)
 TYPE(cls_rgw_obj_key)
 TYPE(rgw_bucket_olh_log_entry)
 TYPE(rgw_usage_log_entry)
+TYPE(rgw_cls_bi_entry)
+TYPE(rgw_bucket_olh_entry)
+TYPE(rgw_usage_data)
+TYPE(rgw_usage_log_info)
+TYPE(rgw_user_bucket)
+TYPE(cls_rgw_lc_entry)
 
 #include "cls/rgw/cls_rgw_ops.h"
 TYPE(cls_rgw_lc_get_entry_ret)