From: Abhishek Lekshmanan Date: Tue, 6 Oct 2020 14:11:36 +0000 (+0200) Subject: rgw: role: add RGWRoleMetadataObject X-Git-Tag: v18.0.0~710^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=90b6642f2a1740deca826c799e4ccfbfcf3d9eac;p=ceph.git rgw: role: add RGWRoleMetadataObject Signed-off-by: Abhishek Lekshmanan --- diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index 38bd8af733d3..b4de07d77173 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -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); +} diff --git a/src/rgw/rgw_role.h b/src/rgw/rgw_role.h index 336458207cd4..134c6600e5cf 100644 --- a/src/rgw/rgw_role.h +++ b/src/rgw/rgw_role.h @@ -147,6 +147,31 @@ public: WRITE_CLASS_ENCODER(RGWRole) } } // namespace rgw::sal +struct RGWRoleCompleteInfo { + rgw::sal::RGWRole info; + std::map 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