From 510db31fc7173ee6b3836ebe80b14e4cf34140b0 Mon Sep 17 00:00:00 2001 From: Pritha Srivastava Date: Wed, 27 Oct 2021 14:42:46 +0530 Subject: [PATCH] rgw: cleanup. Signed-off-by: Pritha Srivastava --- src/rgw/rgw_role.cc | 36 +++--------------------------------- src/rgw/rgw_role.h | 13 ++----------- src/rgw/rgw_service.cc | 10 ---------- src/rgw/rgw_service.h | 7 ------- 4 files changed, 5 insertions(+), 61 deletions(-) diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index beefc2c60b5..02d3687b006 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -329,7 +329,7 @@ RGWRoleMetadataHandler::RGWRoleMetadataHandler(CephContext *cct, Store* store, RGWSI_SysObj *_sysobj_svc) { this->cct = cct; - store = store; + this->store = store; init(_zone_svc, _meta_svc, _meta_be_svc, _sysobj_svc); } @@ -337,14 +337,14 @@ void RGWRoleCompleteInfo::dump(ceph::Formatter *f) const { info->dump(f); if (has_attrs) { - encode_json("attrs", attrs, f); + encode_json("attrs", info->get_attrs(), f); } } void RGWRoleCompleteInfo::decode_json(JSONObj *obj) { decode_json_obj(*info, obj); - has_attrs = JSONDecoder::decode_json("attrs", attrs, obj); + has_attrs = JSONDecoder::decode_json("attrs", info->get_attrs(), obj); } @@ -370,16 +370,6 @@ int RGWRoleMetadataHandler::do_get(RGWSI_MetaBackend_Handler::Op *op, const DoutPrefixProvider *dpp) { RGWRoleCompleteInfo rci; -#if 0 - int ret = svc.role->read_info(op->ctx(), - entry, - &rci.info, - &objv_tracker, - &mtime, - &rci.attrs, - y, - dpp); -#endif rci.info = store->get_role(entry).get(); int ret = rci.info->read_info(dpp, y); if (ret < 0) { @@ -402,14 +392,6 @@ int RGWRoleMetadataHandler::do_remove(RGWSI_MetaBackend_Handler::Op *op, optional_yield y, const DoutPrefixProvider *dpp) { -#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 role = store->get_role(entry); int ret = role->read_info(dpp, y); if (ret < 0) { @@ -440,18 +422,6 @@ public: int put_checked(const DoutPrefixProvider *dpp) override { auto& rci = mdo->get_rci(); auto mtime = mdo->get_mtime(); -#if 0 - int ret = rhandler->role->create(op->ctx(), - rci.info, - &objv_tracker, - mtime, - false, - pattrs, - y, - dpp); - - return ret < 0 ? ret : STATUS_APPLIED; -#endif rci.info->set_mtime(mtime); int ret = rci.info->create(dpp, true, y); return ret < 0 ? ret : STATUS_APPLIED; diff --git a/src/rgw/rgw_role.h b/src/rgw/rgw_role.h index c1204c363f8..3090c94d8fd 100644 --- a/src/rgw/rgw_role.h +++ b/src/rgw/rgw_role.h @@ -13,11 +13,7 @@ #include "rgw/rgw_rados.h" #include "rgw_metadata.h" -class RGWCtl; class RGWRados; -class RGWSI_Role; -class RGWSI_MetaBackend_Handler; -class RGWRoleCtl; namespace rgw { namespace sal { class RGWRole @@ -33,8 +29,6 @@ public: static constexpr uint64_t SESSION_DURATION_MAX = 43200; // in seconds protected: - RGWRoleCtl *role_ctl; - std::string id; std::string name; std::string path; @@ -128,11 +122,9 @@ public: const uint64_t& get_max_session_duration() const { return max_session_duration; } const RGWObjVersionTracker& get_objv_tracker() const { return objv_tracker; } const real_time& get_mtime() const { return mtime; } + std::map& get_attrs() { return attrs; } 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; } void set_mtime(const real_time& mtime) { this->mtime = mtime; } virtual int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) = 0; @@ -159,7 +151,6 @@ WRITE_CLASS_ENCODER(RGWRole) struct RGWRoleCompleteInfo { RGWRole* info; - std::map attrs; bool has_attrs; void dump(Formatter *f) const; @@ -238,7 +229,7 @@ public: private: RGWSI_MetaBackend_Handler *be_handler; std::unique_ptr be_module; - std::unique_ptr store; + Store* store; CephContext *cct; }; } } // namespace rgw::sal diff --git a/src/rgw/rgw_service.cc b/src/rgw/rgw_service.cc index fc723c05394..7188220bc16 100644 --- a/src/rgw/rgw_service.cc +++ b/src/rgw/rgw_service.cc @@ -77,7 +77,6 @@ int RGWServices_Def::init(CephContext *cct, sysobj = std::make_unique(cct); sysobj_core = std::make_unique(cct); user_rados = std::make_unique(cct); - //role_rados = std::make_unique(store); if (have_cache) { sysobj_cache = std::make_unique(dpp, cct); @@ -117,7 +116,6 @@ int RGWServices_Def::init(CephContext *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()); can_shutdown = true; @@ -250,11 +248,6 @@ int RGWServices_Def::init(CephContext *cct, return r; } - //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 or core services will be started by sysobj */ @@ -324,7 +317,6 @@ int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_ cache = _svc.sysobj_cache.get(); core = _svc.sysobj_core.get(); user = _svc.user_rados.get(); - //role = _svc.role_rados.get(); return 0; } @@ -380,7 +372,6 @@ int RGWCtlDef::init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixPr svc.bucket_sync, svc.bi)); otp.reset(new RGWOTPCtl(svc.zone, svc.otp)); - //role = std::make_unique(svc.role, static_cast(meta.role.get())); RGWBucketMetadataHandlerBase *bucket_meta_handler = static_cast(meta.bucket.get()); RGWBucketInstanceMetadataHandlerBase *bi_meta_handler = static_cast(meta.bucket_instance.get()); @@ -424,7 +415,6 @@ int RGWCtl::init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProv user = _ctl.user.get(); bucket = _ctl.bucket.get(); otp = _ctl.otp.get(); - //role = _ctl.role.get(); r = meta.user->attach(meta.mgr); if (r < 0) { diff --git a/src/rgw/rgw_service.h b/src/rgw/rgw_service.h index e70db0d0e6b..b1f59d3ff5c 100644 --- a/src/rgw/rgw_service.h +++ b/src/rgw/rgw_service.h @@ -12,7 +12,6 @@ #include "common/async/yield_context.h" #include "rgw/rgw_common.h" -//#include "rgw/rgw_sal_rados.h" struct RGWServices_Def; @@ -66,8 +65,6 @@ class RGWSI_MetaBackend_OTP; class RGWSI_Notify; class RGWSI_OTP; class RGWSI_RADOS; -//class RGWSI_Role; -//class RGWSI_Role_RADOS; class RGWSI_Zone; class RGWSI_ZoneUtils; class RGWSI_Quota; @@ -108,7 +105,6 @@ struct RGWServices_Def std::unique_ptr sysobj_cache; std::unique_ptr user_rados; std::unique_ptr datalog_rados; - //std::unique_ptr role_rados; RGWServices_Def(); ~RGWServices_Def(); @@ -172,7 +168,6 @@ class RGWMetadataHandler; class RGWUserCtl; class RGWBucketCtl; class RGWOTPCtl; -//class RGWRoleCtl; struct RGWCtlDef { struct _meta { @@ -190,7 +185,6 @@ struct RGWCtlDef { std::unique_ptr user; std::unique_ptr bucket; std::unique_ptr otp; - //std::unique_ptr role; RGWCtlDef(); ~RGWCtlDef(); @@ -217,7 +211,6 @@ struct RGWCtl { RGWUserCtl *user{nullptr}; RGWBucketCtl *bucket{nullptr}; RGWOTPCtl *otp{nullptr}; - //RGWRoleCtl *role{nullptr}; int init(RGWServices *_svc, rgw::sal::Store* store, const DoutPrefixProvider *dpp); }; -- 2.39.5