int RGWRole::store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
{
RGWObjVersionTracker objv_tracker;
- return role_ctl->store_info(this,
- y,
- dpp,
- RGWRoleCtl::PutParams().
- set_exclusive(exclusive).
- set_objv_tracker(&objv_tracker));
-}
-
-int RGWRole::store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
-{
- RGWObjVersionTracker objv_tracker;
- return role_ctl->store_name(id,
- name,
- tenant,
- y,
- dpp,
- RGWRoleCtl::PutParams().
- set_exclusive(exclusive).
- set_objv_tracker(&objv_tracker)
- );
-}
-
-int RGWRole::store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
-{
- RGWObjVersionTracker objv_tracker;
- return role_ctl->store_path(id,
- path,
- tenant,
+ return role_ctl->store_info(*this,
y,
dpp,
RGWRoleCtl::PutParams().
});
}
-int RGWRoleCtl::store_info(const rgw::sal::RGWRole* role,
+int RGWRoleCtl::store_info(const rgw::sal::RGWRole& role,
optional_yield y,
const DoutPrefixProvider *dpp,
const PutParams& params)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
return svc.role->store_info(op->ctx(),
- *role,
+ role,
params.objv_tracker,
params.mtime,
params.exclusive,
return make_pair(ret, role_id);
}
-int RGWRoleCtl::delete_info(const rgw::sal::RGWRole& info,
+int RGWRoleCtl::delete_info(const std::string& role_id,
optional_yield y,
const DoutPrefixProvider *dpp,
const RemoveParams& params)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
return svc.role->delete_info(op->ctx(),
- info.get_id(),
+ role_id,
params.objv_tracker,
y, dpp);
});
optional_yield y,
const DoutPrefixProvider *dpp)
{
- return svc.role->delete_info(op->ctx(), entry, &objv_tracker, y, dpp);
+ rgw::sal::RGWRole info;
+ real_time _mtime;
+ int ret = svc.role->read_info(op->ctx(), entry, &info, &objv_tracker,
+ &_mtime, nullptr, y, dpp);
+ if (ret < 0) {
+ return ret == -ENOENT ? 0 : ret;
+ }
+ return svc.role->delete_role(op->ctx(), info, &objv_tracker, y, dpp);
}
class RGWMetadataHandlerPut_Role : public RGWMetadataHandlerPut_SObj
public:
virtual int store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
- virtual int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
- virtual int store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
+ virtual int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { return 0; }
+ virtual int store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { return 0; }
virtual int read_id(const DoutPrefixProvider *dpp, const std::string& role_name, const std::string& tenant, std::string& role_id, optional_yield y);
virtual int read_name(const DoutPrefixProvider *dpp, optional_yield y);
virtual int read_info(const DoutPrefixProvider *dpp, optional_yield y);
}
};
- int store_info(const rgw::sal::RGWRole* role,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const PutParams& params = {});
int create(rgw::sal::RGWRole& role,
optional_yield y,
const DoutPrefixProvider *dpp,
const PutParams& params = {});
+ int store_info(const rgw::sal::RGWRole& role,
+ optional_yield y,
+ const DoutPrefixProvider *dpp,
+ const PutParams& params = {});
+
+ // The methods for store name & store path are currently unused and only
+ // useful for a potential rename name/path functionality in the future as
+ // create role would automatically create these for most uses
int store_name(const std::string& role_id,
const std::string& name,
const std::string& tenant,
const DoutPrefixProvider *dpp,
const GetParams& params = {});
- int delete_info(const rgw::sal::RGWRole& info,
+ int delete_info(const std::string& role_id,
optional_yield y,
const DoutPrefixProvider *dpp,
const RemoveParams& params = {});