Removing references to RGW services and RGW Ctl.
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
services/svc_quota.cc
services/svc_sync_modules.cc
services/svc_rados.cc
- services/svc_role.cc
- services/svc_role_rados.cc
services/svc_sys_obj.cc
services/svc_sys_obj_cache.cc
services/svc_sys_obj_core.cc
int RGWRados::init_ctl(const DoutPrefixProvider *dpp)
{
- return ctl.init(&svc, dpp);
+ return ctl.init(&svc, store, dpp);
}
/**
#include "services/svc_zone.h"
#include "services/svc_sys_obj.h"
#include "services/svc_role.h"
+#include "services/svc_meta_be_sobj.h"
+#include "services/svc_meta.h"
#define dout_subsys ceph_subsys_rgw
const string RGWRole::role_path_oid_prefix = "role_paths.";
const string RGWRole::role_arn_prefix = "arn:aws:iam::";
-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));
-}
-
-// Creation time
-auto generate_ctime() {
- real_clock::time_point t = real_clock::now();
-
- struct timeval tv;
- real_clock::to_timeval(t, tv);
-
- char buf[30];
- struct tm result;
- gmtime_r(&tv.tv_sec, &result);
- strftime(buf,30,"%Y-%m-%dT%H:%M:%S", &result);
- sprintf(buf + strlen(buf),".%dZ",(int)tv.tv_usec/1000);
- string ct;
- ct.assign(buf, strlen(buf));
- return ct;
-}
-
-
-int RGWRole::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
-{
- if (!validate_input(dpp)) {
- ldpp_dout(dpp, 0) << "ERROR: invalid input " << dendl;
- return -EINVAL;
- }
-
- uuid_d new_role_id;
- new_role_id.generate_random();
-
- id = new_role_id.to_string();
- arn = role_arn_prefix + tenant + ":role" + path + name;
- creation_date = generate_ctime();
-
-
- RGWObjVersionTracker objv_tracker;
- return role_ctl->create(*this, y, dpp,
- RGWRoleCtl::PutParams().
- set_exclusive(exclusive).
- set_objv_tracker(&objv_tracker));
-}
-
-int RGWRole::delete_obj(const DoutPrefixProvider *dpp, optional_yield y)
-{
-
- int ret = read_name(dpp, y);
- if (ret < 0) {
- return ret;
- }
-
- ret = read_info(dpp, y);
- if (ret < 0) {
- return ret;
- }
-
- if (! perm_policy_map.empty()) {
- return -ERR_DELETE_CONFLICT;
- }
-
- RGWObjVersionTracker ot;
- ret = role_ctl->delete_role(*this, y, dpp,
- RGWRoleCtl::RemoveParams().
- set_objv_tracker(&ot));
- if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: deleting role: "<< id
- << cpp_strerror(-ret) << dendl;
- }
-
- return ret;
-}
-
int RGWRole::get(const DoutPrefixProvider *dpp, optional_yield y)
{
int ret = read_name(dpp, y);
JSONDecoder::decode_json("AssumeRolePolicyDocument", trust_policy, obj);
}
-int RGWRole::read_id(const DoutPrefixProvider *dpp, const std::string& role_name, const std::string& tenant, std::string& role_id, optional_yield y)
-{
- int ret;
- RGWObjVersionTracker ot;
- std::tie(ret, role_id) = role_ctl->read_name(role_name, tenant, y, dpp,
- RGWRoleCtl::GetParams().
- set_objv_tracker(&ot));
- if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed reading role id with params"
- << role_name << ", " << tenant << ":"
- << cpp_strerror(ret) << dendl;
- }
-
- return ret;
-}
-
-int RGWRole::read_info(const DoutPrefixProvider *dpp, optional_yield y)
-{
-
- RGWObjVersionTracker ot;
- auto ret = role_ctl->read_info(id, y, dpp, this,
- RGWRoleCtl::GetParams().
- set_objv_tracker(&ot));
- if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed reading role info from pool: "
- ": " << id << ": " << cpp_strerror(-ret) << dendl;
- return ret;
- }
-
- return 0;
-}
-
-int RGWRole::read_name(const DoutPrefixProvider *dpp, optional_yield y)
-{
- RGWObjVersionTracker ot;
- auto [ret, _id] = role_ctl->read_name(name, tenant, y, dpp,
- RGWRoleCtl::GetParams().
- set_objv_tracker(&ot));
- if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed reading role name from pool: "
- << name << ": " << cpp_strerror(-ret) << dendl;
- return ret;
- }
-
- id = _id;
- return 0;
-}
-
bool RGWRole::validate_input(const DoutPrefixProvider* dpp)
{
if (name.length() > MAX_ROLE_NAME_LEN) {
{
return role_path_oid_prefix;
}
-} } // namespace rgw::sal
-int RGWRoleCtl::create(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->create(op->ctx(),
- role,
- params.objv_tracker,
- params.mtime,
- params.exclusive,
- params.attrs,
- y,
- dpp);
- });
-}
+class RGWSI_Role_Module : public RGWSI_MBSObj_Handler_Module {
+ RGWRoleMetadataHandler::Svc& svc;
+ const std::string prefix;
+public:
+ RGWSI_Role_Module(RGWRoleMetadataHandler::Svc& _svc): RGWSI_MBSObj_Handler_Module("roles"),
+ svc(_svc),
+ prefix(rgw::sal::RGWRole::get_info_oid_prefix()) {}
-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,
- params.objv_tracker,
- params.mtime,
- params.exclusive,
- params.attrs,
- y, dpp);
- });
-}
+ void get_pool_and_oid(const std::string& key,
+ rgw_pool *pool,
+ std::string *oid) override
+ {
+ if (pool) {
+ *pool = svc.zone->get_zone_params().roles_pool;
+ }
-int RGWRoleCtl::store_name(const std::string& role_id,
- const std::string& name,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const PutParams& params)
-{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->store_name(op->ctx(),
- role_id,
- name,
- tenant,
- params.objv_tracker,
- params.mtime,
- params.exclusive,
- y, dpp);
- });
-}
+ if (oid) {
+ *oid = key_to_oid(key);
+ }
+ }
-int RGWRoleCtl::store_path(const std::string& role_id,
- const std::string& path,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const PutParams& params)
-{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->store_path(op->ctx(),
- role_id,
- path,
- tenant,
- params.objv_tracker,
- params.mtime,
- params.exclusive,
- y, dpp);
- });
-}
+ bool is_valid_oid(const std::string& oid) override {
+ return boost::algorithm::starts_with(oid, prefix);
+ }
-int
-RGWRoleCtl::read_info(const std::string& role_id,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- rgw::sal::RGWRole* info,
- const GetParams& params)
-{
- int ret = be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->read_info(op->ctx(),
- role_id,
- info,
- params.objv_tracker,
- params.mtime,
- params.attrs,
- y, dpp);
- });
- return ret;
-}
+ std::string key_to_oid(const std::string& key) override {
+ return prefix + key;
+ }
-std::pair<int, std::string>
-RGWRoleCtl::read_name(const std::string& name,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const GetParams& params)
-{
- std::string role_id;
- int ret = be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->read_name(op->ctx(),
- name,
- tenant,
- role_id,
- params.objv_tracker,
- params.mtime,
- y, dpp);
- });
- return make_pair(ret, role_id);
-}
+ // This is called after `is_valid_oid` and is assumed to be a valid oid
+ std::string oid_to_key(const std::string& oid) override {
+ return oid.substr(prefix.size());
+ }
-int RGWRoleCtl::delete_role(const rgw::sal::RGWRole& info,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params)
-{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->delete_role(op->ctx(),
- info,
- params.objv_tracker,
- y, dpp);
- });
- return 0;
-}
+ const std::string& get_oid_prefix() {
+ return prefix;
+ }
+};
-int RGWRoleCtl::delete_info(const std::string& role_id,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params)
+RGWSI_MetaBackend_Handler* RGWRoleMetadataHandler::get_be_handler()
{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->delete_info(op->ctx(),
- role_id,
- params.objv_tracker,
- y, dpp);
- });
- return 0;
+ return be_handler;
}
-int RGWRoleCtl::delete_name(const std::string& name,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params)
+void RGWRoleMetadataHandler::init(RGWSI_Zone *_zone_svc,
+ RGWSI_Meta *_meta_svc,
+ RGWSI_MetaBackend *_meta_be_svc,
+ RGWSI_SysObj *_sysobj_svc)
{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->delete_name(op->ctx(),
- name,
- tenant,
- params.objv_tracker,
- y, dpp);
- });
+ svc.zone = _zone_svc;
+ svc.meta = _meta_svc;
+ svc.meta_be = _meta_be_svc;
+ svc.sysobj = _sysobj_svc;
}
-int RGWRoleCtl::delete_path(const std::string& role_id,
- const std::string& path,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params)
+int RGWRoleMetadataHandler::do_start(optional_yield y, const DoutPrefixProvider *dpp)
{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->delete_path(op->ctx(),
- role_id,
- path,
- tenant,
- params.objv_tracker,
- y, dpp);
- });
-}
-int RGWRoleCtl::list_roles_by_path_prefix(const std::string& path_prefix,
- const std::string& tenant,
- std::vector<rgw::sal::RGWRole>& roles,
- optional_yield y,
- const DoutPrefixProvider *dpp)
-{
- return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.role->list_roles_by_path_prefix(op->ctx(),
- path_prefix,
- tenant,
- roles,
- y,
- dpp);
- });
+ int r = svc.meta->create_be_handler(RGWSI_MetaBackend::Type::MDBE_SOBJ,
+ &be_handler);
+ if (r < 0) {
+ //ldout(ctx(), 0) << "ERROR: failed to create be_handler for Roles: r="
+ // << r <<dendl;
+ return r;
+ }
+
+ auto module = new RGWSI_Role_Module(svc);
+ RGWSI_MetaBackend_Handler_SObj* bh= static_cast<RGWSI_MetaBackend_Handler_SObj *>(be_handler);
+ be_module.reset(module);
+ bh->set_module(module);
+ return 0;
}
-RGWRoleMetadataHandler::RGWRoleMetadataHandler(RGWSI_Role *role_svc)
+RGWRoleMetadataHandler::RGWRoleMetadataHandler(CephContext *cct, Store* store)
{
- base_init(role_svc->ctx(), role_svc->get_be_handler());
- svc.role = role_svc;
+ base_init(cct, get_be_handler());
+ store = store;
}
void RGWRoleCompleteInfo::dump(ceph::Formatter *f) const
{
- info.dump(f);
+ info->dump(f);
if (has_attrs) {
encode_json("attrs", attrs, f);
}
void RGWRoleCompleteInfo::decode_json(JSONObj *obj)
{
- decode_json_obj(info, obj);
+ decode_json_obj(*info, obj);
has_attrs = JSONDecoder::decode_json("attrs", attrs, obj);
}
RGWObjVersionTracker objv_tracker;
real_time mtime;
+#if 0
int ret = svc.role->read_info(op->ctx(),
entry,
&rci.info,
&rci.attrs,
y,
dpp);
-
+#endif
+ rci.info = store->get_role(entry).get();
+ int ret = rci.info->read_info(dpp, y);
if (ret < 0) {
return ret;
}
optional_yield y,
const DoutPrefixProvider *dpp)
{
- rgw::sal::RGWRole info;
- real_time _mtime;
+#if 0
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);
+#endif
+ std::unique_ptr<rgw::sal::RGWRole> role = store->get_role(entry);
+ int ret = role->read_info(dpp, y);
+ if (ret < 0) {
+ return ret == -ENOENT? 0 : ret;
+ }
+
+ return role->delete_obj(dpp, y);
}
class RGWMetadataHandlerPut_Role : public RGWMetadataHandlerPut_SObj
auto& rci = mdo->get_rci();
auto mtime = mdo->get_mtime();
map<std::string, bufferlist> *pattrs = rci.has_attrs ? &rci.attrs : nullptr;
-
- int ret = rhandler->svc.role->create(op->ctx(),
+#if 0
+ int ret = rhandler->role->create(op->ctx(),
rci.info,
&objv_tracker,
mtime,
dpp);
return ret < 0 ? ret : STATUS_APPLIED;
+#endif
+ int ret = rci.info->create(dpp, true, y);
+ return ret < 0 ? ret : STATUS_APPLIED;
}
};
RGWMetadataHandlerPut_Role put_op(this, op , entry, obj, objv_tracker, y, type, from_remote_zone);
return do_put_operate(&put_op, dpp);
}
+
+} } // namespace rgw::sal
class RGWCtl;
class RGWRados;
-class RGWRoleMetadataHandler;
class RGWSI_Role;
class RGWSI_MetaBackend_Handler;
class RGWRoleCtl;
std::multimap<std::string,std::string> tags;
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) { 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);
+ virtual int store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) = 0;
+ virtual int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) = 0;
+ virtual int store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) = 0;
+ virtual int read_id(const DoutPrefixProvider *dpp, const std::string& role_name, const std::string& tenant, std::string& role_id, optional_yield y) = 0;
+ virtual int read_name(const DoutPrefixProvider *dpp, optional_yield y) = 0;
+ virtual int read_info(const DoutPrefixProvider *dpp, optional_yield y) = 0;
bool validate_input(const DoutPrefixProvider* dpp);
void extract_name_tenant(const std::string& str);
const uint64_t& get_max_session_duration() const { return max_session_duration; }
void set_id(const std::string& id) { this->id = id; }
+ //TODO: Remove the following two
void set_arn(const std::string& arn) { this->arn = arn; }
void set_creation_date(const std::string& creation_date) { this->creation_date = creation_date; }
- virtual int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y);
- virtual int delete_obj(const DoutPrefixProvider *dpp, optional_yield y);
+ virtual int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) = 0;
+ virtual int delete_obj(const DoutPrefixProvider *dpp, optional_yield y) = 0;
int get(const DoutPrefixProvider *dpp, optional_yield y);
int get_by_id(const DoutPrefixProvider *dpp, optional_yield y);
int update(const DoutPrefixProvider *dpp, optional_yield y);
static const std::string& get_path_oid_prefix();
};
WRITE_CLASS_ENCODER(RGWRole)
-} } // namespace rgw::sal
struct RGWRoleCompleteInfo {
- rgw::sal::RGWRole info;
+ RGWRole* info;
std::map<std::string, bufferlist> attrs;
bool has_attrs;
return rci;
}
};
-//class RGWMetadataObject;
class RGWRoleMetadataHandler: public RGWMetadataHandler_GenericMetaBE
{
-
public:
struct Svc {
- RGWSI_Role *role{nullptr};
+ RGWSI_Zone *zone{nullptr};
+ RGWSI_Meta *meta{nullptr};
+ RGWSI_MetaBackend *meta_be{nullptr};
+ RGWSI_SysObj *sysobj{nullptr};
} svc;
- RGWRoleMetadataHandler(RGWSI_Role *role_svc);
+ void init(RGWSI_Zone *_zone_svc,
+ RGWSI_Meta *_meta_svc,
+ RGWSI_MetaBackend *_meta_be_svc,
+ RGWSI_SysObj *_sysobj_svc);
+
+ RGWSI_MetaBackend_Handler * get_be_handler();
+
+ int do_start(optional_yield y, const DoutPrefixProvider *dpp);
+
+ RGWRoleMetadataHandler(CephContext *cct, Store* store);
std::string get_type() final { return "roles"; }
const DoutPrefixProvider *dpp,
RGWMDLogSyncType type,
bool from_remote_zone) override;
-};
-
-/// Defines control classes that call the low level service layer that handles
-/// storage, svc classes implement the low level object operations. Ctl classes
-/// can span over multiple service classes, for eg. User Ctl classes need to
-/// update the user indices when buckets are added/removed RoleCtl classes may
-/// need to update the RGW Account class that a role has been added deleted
-/// under an account.
-class RGWRoleCtl {
- struct Svc {
- RGWSI_Role *role {nullptr};
- } svc;
- RGWRoleMetadataHandler *rmhandler;
- RGWSI_MetaBackend_Handler *be_handler{nullptr};
-public:
- RGWRoleCtl(RGWSI_Role *_role_svc,
- RGWRoleMetadataHandler *_rmhandler) {
- svc.role = _role_svc;
- rmhandler = _rmhandler;
- be_handler = _rmhandler->get_be_handler();
- }
-
- struct PutParams {
- ceph::real_time mtime;
- bool exclusive {false};
- RGWObjVersionTracker *objv_tracker {nullptr};
- std::map<std::string, bufferlist> *attrs {nullptr};
-
- PutParams() {}
-
- PutParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
- objv_tracker = _objv_tracker;
- return *this;
- }
-
- PutParams& set_mtime(const ceph::real_time& _mtime) {
- mtime = _mtime;
- return *this;
- }
-
- PutParams& set_exclusive(bool _exclusive) {
- exclusive = _exclusive;
- return *this;
- }
- PutParams& set_attrs(std::map<std::string, bufferlist> *_attrs) {
- attrs = _attrs;
- return *this;
- }
- };
-
- struct GetParams {
- ceph::real_time *mtime{nullptr};
- std::map<std::string, bufferlist> *attrs{nullptr};
- RGWObjVersionTracker *objv_tracker {nullptr};
-
- GetParams() {}
-
- GetParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
- objv_tracker = _objv_tracker;
- return *this;
- }
-
- GetParams& set_mtime(ceph::real_time *_mtime) {
- mtime = _mtime;
- return *this;
- }
-
- GetParams& set_attrs(std::map<std::string, bufferlist> *_attrs) {
- attrs = _attrs;
- return *this;
- }
- };
-
- struct RemoveParams {
- RGWObjVersionTracker *objv_tracker{nullptr};
-
- RemoveParams() {}
-
- RemoveParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) {
- objv_tracker = _objv_tracker;
- return *this;
- }
- };
-
-
- 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,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const PutParams& params = {});
-
- int store_path(const std::string& role_id,
- const std::string& path,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const PutParams& params = {});
-
- int read_info(const std::string& role_id,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- rgw::sal::RGWRole* role,
- const GetParams& params = {});
-
- std::pair<int, std::string> read_name(const std::string& name,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const GetParams& params = {});
-
- int delete_role(const rgw::sal::RGWRole& role,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params = {});
-
- int delete_info(const std::string& role_id,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params = {});
-
- int delete_name(const std::string& name,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params = {});
-
- int delete_path(const std::string& role_id,
- const std::string& path,
- const std::string& tenant,
- optional_yield y,
- const DoutPrefixProvider *dpp,
- const RemoveParams& params = {});
-
- int list_roles_by_path_prefix(const std::string& path_prefix,
- const std::string& tenant,
- std::vector<rgw::sal::RGWRole>& roles,
- optional_yield y,
- const DoutPrefixProvider *dpp);
+private:
+ RGWSI_MetaBackend_Handler *be_handler;
+ std::unique_ptr<RGWSI_MetaBackend::Module> be_module;
+ std::unique_ptr<Store> store;
};
+} } // namespace rgw::sal
+
#endif /* CEPH_RGW_ROLE_H */
#include "rgw_lc.h"
#include "rgw_lc_tier.h"
#include "services/svc_sys_obj.h"
+#include "services/svc_meta.h"
+#include "services/svc_meta_be_sobj.h"
#include "services/svc_zone.h"
#include "services/svc_tier_rados.h"
#include "services/svc_quota.h"
return ret;
}
-
} // namespace rgw::sal
extern "C" {
std::string max_session_duration,
std::multimap<std::string,std::string> tags) : RGWRole(name, tenant, path, trust_policy, max_session_duration, tags), store(_store) {}
RadosRole(RadosStore* _store, std::string id) : RGWRole(id), store(_store) {}
+ RadosRole(RadosStore* _store) : store(_store) {}
~RadosRole() = default;
virtual int store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) override;
virtual int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) override;
virtual int delete_obj(const DoutPrefixProvider *dpp, optional_yield y) override;
};
-
-} } // namespace rgw::sal
+}} // namespace rgw::sal
WRITE_CLASS_ENCODER(rgw::sal::RadosOIDCProvider)
#include "rgw_otp.h"
#include "rgw_user.h"
#include "rgw_role.h"
+#include "rgw_sal_rados.h"
#define dout_subsys ceph_subsys_rgw
sysobj = std::make_unique<RGWSI_SysObj>(cct);
sysobj_core = std::make_unique<RGWSI_SysObj_Core>(cct);
user_rados = std::make_unique<RGWSI_User_RADOS>(cct);
- role_rados = std::make_unique<RGWSI_Role_RADOS>(cct);
+ //role_rados = std::make_unique<rgw::sal::RadosRole>(store);
if (have_cache) {
sysobj_cache = std::make_unique<RGWSI_SysObj_Cache>(dpp, cct);
}
user_rados->init(rados.get(), zone.get(), sysobj.get(), sysobj_cache.get(),
meta.get(), meta_be_sobj.get(), sync_modules.get());
- role_rados->init(zone.get(), meta.get(), meta_be_sobj.get(), sysobj.get());
+ //role_rados->init(zone.get(), meta.get(), meta_be_sobj.get(), sysobj.get());
can_shutdown = true;
return r;
}
- r = role_rados->start(y, dpp);
+ //r = role_rados->start(y, dpp);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start role_rados service (" << cpp_strerror(-r) << dendl;
return r;
cache = _svc.sysobj_cache.get();
core = _svc.sysobj_core.get();
user = _svc.user_rados.get();
- role = _svc.role_rados.get();
+ //role = _svc.role_rados.get();
return 0;
}
RGWCtlDef::_meta::~_meta() {}
-int RGWCtlDef::init(RGWServices& svc, const DoutPrefixProvider *dpp)
+int RGWCtlDef::init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp)
{
meta.mgr.reset(new RGWMetadataManager(svc.meta));
}
meta.otp.reset(RGWOTPMetaHandlerAllocator::alloc());
- meta.role = std::make_unique<RGWRoleMetadataHandler>(svc.role);
+ meta.role = std::make_unique<rgw::sal::RGWRoleMetadataHandler>(svc.cct, store);
user.reset(new RGWUserCtl(svc.zone, svc.user, (RGWUserMetadataHandler *)meta.user.get()));
bucket.reset(new RGWBucketCtl(svc.zone,
svc.bucket_sync,
svc.bi));
otp.reset(new RGWOTPCtl(svc.zone, svc.otp));
- role = std::make_unique<RGWRoleCtl>(svc.role, static_cast<RGWRoleMetadataHandler*>(meta.role.get()));
+ //role = std::make_unique<RGWRoleCtl>(svc.role, static_cast<RGWRoleMetadataHandler*>(meta.role.get()));
RGWBucketMetadataHandlerBase *bucket_meta_handler = static_cast<RGWBucketMetadataHandlerBase *>(meta.bucket.get());
RGWBucketInstanceMetadataHandlerBase *bi_meta_handler = static_cast<RGWBucketInstanceMetadataHandlerBase *>(meta.bucket_instance.get());
return 0;
}
-int RGWCtl::init(RGWServices *_svc, const DoutPrefixProvider *dpp)
+int RGWCtl::init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp)
{
svc = _svc;
cct = svc->cct;
- int r = _ctl.init(*svc, dpp);
+ int r = _ctl.init(*svc, store, dpp);
if (r < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to start init ctls (" << cpp_strerror(-r) << dendl;
return r;
user = _ctl.user.get();
bucket = _ctl.bucket.get();
otp = _ctl.otp.get();
- role = _ctl.role.get();
+ //role = _ctl.role.get();
r = meta.user->attach(meta.mgr);
if (r < 0) {
#include "common/async/yield_context.h"
#include "rgw/rgw_common.h"
+//#include "rgw/rgw_sal_rados.h"
struct RGWServices_Def;
class RGWSI_Notify;
class RGWSI_OTP;
class RGWSI_RADOS;
-class RGWSI_Role;
-class RGWSI_Role_RADOS;
+//class RGWSI_Role;
+//class RGWSI_Role_RADOS;
class RGWSI_Zone;
class RGWSI_ZoneUtils;
class RGWSI_Quota;
class RGWSI_User;
class RGWSI_User_RADOS;
class RGWDataChangesLog;
+class RGWRole;
struct RGWServices_Def
{
std::unique_ptr<RGWSI_SysObj_Cache> sysobj_cache;
std::unique_ptr<RGWSI_User_RADOS> user_rados;
std::unique_ptr<RGWDataChangesLog> datalog_rados;
- std::unique_ptr<RGWSI_Role_RADOS> role_rados;
+ //std::unique_ptr<rgw::sal::RadosRole> role_rados;
RGWServices_Def();
~RGWServices_Def();
RGWSI_SysObj_Cache *cache{nullptr};
RGWSI_SysObj_Core *core{nullptr};
RGWSI_User *user{nullptr};
- RGWSI_Role *role{nullptr};
+ RGWRole *role{nullptr};
int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp);
class RGWUserCtl;
class RGWBucketCtl;
class RGWOTPCtl;
-class RGWRoleCtl;
+//class RGWRoleCtl;
struct RGWCtlDef {
struct _meta {
std::unique_ptr<RGWUserCtl> user;
std::unique_ptr<RGWBucketCtl> bucket;
std::unique_ptr<RGWOTPCtl> otp;
- std::unique_ptr<RGWRoleCtl> role;
+ //std::unique_ptr<RGWRoleCtl> role;
RGWCtlDef();
~RGWCtlDef();
- int init(RGWServices& svc, const DoutPrefixProvider *dpp);
+ int init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
};
struct RGWCtl {
RGWUserCtl *user{nullptr};
RGWBucketCtl *bucket{nullptr};
RGWOTPCtl *otp{nullptr};
- RGWRoleCtl *role{nullptr};
+ //RGWRoleCtl *role{nullptr};
- int init(RGWServices *_svc, const DoutPrefixProvider *dpp);
+ int init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp);
};
#endif