]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: role: add RGWRoleMetadataObject
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 6 Oct 2020 14:11:36 +0000 (16:11 +0200)
committerPritha Srivastava <prsrivas@redhat.com>
Mon, 6 Jun 2022 10:49:42 +0000 (16:19 +0530)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_role.cc
src/rgw/rgw_role.h

index 38bd8af733d3edc597ad79b743f442cf2e0b7bed..b4de07d771738afa30bc6a6ad497fdefcc3396c2 100644 (file)
@@ -573,3 +573,17 @@ RGWRoleMetadataHandler::RGWRoleMetadataHandler(RGWSI_Role *role_svc)
   base_init(role_svc->ctx(), role_svc->get_be_handler());
   svc.role = role_svc;
 }
+
+void RGWRoleCompleteInfo::dump(ceph::Formatter *f) const
+{
+  info.dump(f);
+  if (has_attrs) {
+    encode_json("attrs", attrs, f);
+  }
+}
+
+void RGWRoleCompleteInfo::decode_json(JSONObj *obj)
+{
+  decode_json_obj(info, obj);
+  has_attrs = JSONDecoder::decode_json("attrs", attrs, obj);
+}
index 336458207cd40e97ea5d1ac26d29af4863ff3883..134c6600e5cf7aa416a2e2296bae38a555410680 100644 (file)
@@ -147,6 +147,31 @@ public:
 WRITE_CLASS_ENCODER(RGWRole)
 } } // namespace rgw::sal
 
+struct RGWRoleCompleteInfo {
+  rgw::sal::RGWRole info;
+  std::map<std::string, bufferlist> attrs;
+  bool has_attrs;
+
+  void dump(Formatter *f) const;
+  void decode_json(JSONObj *obj);
+};
+
+class RGWRoleMetadataObject: public RGWMetadataObject {
+  RGWRoleCompleteInfo rci;
+public:
+  RGWRoleMetadataObject() = default;
+  RGWRoleMetadataObject(const RGWRoleCompleteInfo& _rci,
+                       const obj_version& v,
+                       real_time m) : RGWMetadataObject(v,m), rci(_rci) {}
+
+  void dump(Formatter *f) const override {
+    rci.dump(f);
+  }
+
+  RGWRoleCompleteInfo& get_rci() {
+    return rci;
+  }
+};
 //class RGWMetadataObject;
 
 class RGWRoleMetadataHandler: public RGWMetadataHandler_GenericMetaBE