]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add several types to ceph-dencoder.
authorMarcus Watts <mwatts@redhat.com>
Fri, 3 Aug 2018 03:49:30 +0000 (23:49 -0400)
committerShilpa Jagannath <smanjara@redhat.com>
Tue, 30 Jul 2019 08:30:45 +0000 (14:00 +0530)
Add types: RGWBucketEntryPoint obj_version rgw_user
These are structures that are visible as data at rest
inside of rados when a bucket is made via radosgw.

RGWBucketEntryPoint is the contents of a rados
object with names that may be either "<bucket-name>"
or "<tenant>/<bucket-name>"

rgw_user is a structure contained inside of RGWBucketEntryPoint
and other structures.

obj_version is visible as the xattr "ceph.objclass.version"
on rados objects in ".rgw.meta" that contain ".bucket.meta."

Fixes: http://tracker.ceph.com/issues/35885
Signed-off-by: Marcus Watts <mwatts@redhat.com>
src/cls/version/cls_version_types.h
src/rgw/rgw_basic_types.h
src/rgw/rgw_common.h
src/rgw/rgw_dencoder.cc
src/rgw/rgw_json_enc.cc

index 15433b46fd11058146f8c46245badab1a438fe3f..852183f30e57a017f646e8653d3376ea259ed2b0 100644 (file)
@@ -47,6 +47,7 @@ struct obj_version {
 
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj);
+  static void generate_test_instances(list<obj_version*>& o);
 };
 WRITE_CLASS_ENCODER(obj_version)
 
index b2b9b7b4ec75c13342d3cd41fa451c86cc44078c..eb19311b21d0fd8c633bbb10988d4bcf71af70c2 100644 (file)
@@ -104,6 +104,8 @@ struct rgw_user {
     }
     return (id < rhs.id);
   }
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<rgw_user*>& o);
 };
 WRITE_CLASS_ENCODER(rgw_user)
 
index 88febde24b72986b7cf95edbe7541dadd0565034..80738a7b763074da2525f0c5a72b77842cb41445 100644 (file)
@@ -1599,6 +1599,7 @@ struct RGWBucketEntryPoint
 
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj);
+  static void generate_test_instances(list<RGWBucketEntryPoint*>& o);
 };
 WRITE_CLASS_ENCODER(RGWBucketEntryPoint)
 
index 41216fe91b27e643e423f4b1046a017e53433c96..2cbbcb05d061f6a2244e043a4147b679558c361a 100644 (file)
@@ -573,3 +573,32 @@ void objexp_hint_entry::generate_test_instances(list<objexp_hint_entry*>& o)
   o.push_back(it);
   o.push_back(new objexp_hint_entry);
 }
+
+void RGWBucketEntryPoint::generate_test_instances(list<RGWBucketEntryPoint*>& o)
+{
+  RGWBucketEntryPoint *bp = new RGWBucketEntryPoint();
+  init_bucket(&bp->bucket, "tenant", "bucket", "pool", ".index.pool", "marker", "10");
+  bp->owner = "owner";
+  bp->creation_time = ceph::real_clock::from_ceph_timespec({{2}, {3}});
+
+  o.push_back(bp);
+  o.push_back(new RGWBucketEntryPoint);
+}
+
+void rgw_user::generate_test_instances(list<rgw_user*>& o)
+{
+  rgw_user *u = new rgw_user("tenant", "user");
+
+  o.push_back(u);
+  o.push_back(new rgw_user);
+}
+
+void obj_version::generate_test_instances(list<obj_version*>& o)
+{
+  obj_version *v = new obj_version;
+  v->ver = 5;
+  v->tag = "tag";
+
+  o.push_back(v);
+  o.push_back(new obj_version);
+}
index 6b4756cda9054d7bfb95e68b3f38b75ee787fc9f..60b621e3bf9e9a2d99ffa8a0fe609b341c7d4efd 100644 (file)
@@ -1760,3 +1760,8 @@ void objexp_hint_entry::dump(Formatter *f) const
   encode_json("exp_time", ut, f);
   f->close_section();
 }
+
+void rgw_user::dump(Formatter *f) const
+{
+  ::encode_json("user", *this, f);
+}