Skip to content

Commit

Permalink
rgw: role: add RGWRoleMetadataObject
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
  • Loading branch information
theanalyst authored and pritha-srivastava committed Jun 6, 2022
1 parent 0ca6756 commit 90b6642
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/rgw/rgw_role.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
25 changes: 25 additions & 0 deletions src/rgw/rgw_role.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,31 @@ class RGWRole
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
Expand Down

0 comments on commit 90b6642

Please sign in to comment.