From 90b6642f2a1740deca826c799e4ccfbfcf3d9eac Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Tue, 6 Oct 2020 16:11:36 +0200 Subject: [PATCH] rgw: role: add RGWRoleMetadataObject Signed-off-by: Abhishek Lekshmanan --- src/rgw/rgw_role.cc | 14 ++++++++++++++ src/rgw/rgw_role.h | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index 38bd8af733d..b4de07d7717 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 336458207cd..134c6600e5c 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 -- 2.47.3