diff --git a/src/rgw/services/svc_rados.h b/src/rgw/services/svc_rados.h index ee94e81ff46..4d79c9ea6da 100644 --- a/src/rgw/services/svc_rados.h +++ b/src/rgw/services/svc_rados.h @@ -115,20 +115,6 @@ public: public: Obj() {} - Obj(const Obj& o) : rados_svc(o.rados_svc), - rados_handle(o.rados_handle), - ref(o.ref) {} - - Obj(Obj&& o) : rados_svc(o.rados_svc), - rados_handle(o.rados_handle), - ref(std::move(o.ref)) {} - - Obj& operator=(Obj&& o) { - rados_svc = o.rados_svc; - rados_handle = o.rados_handle; - ref = std::move(o.ref); - return *this; - } int open(); @@ -170,9 +156,6 @@ public: Pool(RGWSI_RADOS *_rados_svc) : rados_svc(_rados_svc) {} public: Pool() {} - Pool(const Pool& p) : rados_svc(p.rados_svc), - rados_handle(p.rados_handle), - pool(p.pool) {} int create(const std::vector& pools, std::vector *retcodes); int lookup(const rgw_pool& pool); diff --git a/src/rgw/services/svc_sys_obj_cache.cc b/src/rgw/services/svc_sys_obj_cache.cc index 9d43480fd17..03786a8ff91 100644 --- a/src/rgw/services/svc_sys_obj_cache.cc +++ b/src/rgw/services/svc_sys_obj_cache.cc @@ -51,7 +51,7 @@ static string normal_name(rgw_pool& pool, const std::string& oid) { return buf; } -void RGWSI_SysObj_Cache::normalize_pool_and_obj(rgw_pool& src_pool, const string& src_obj, rgw_pool& dst_pool, string& dst_obj) +void RGWSI_SysObj_Cache::normalize_pool_and_obj(const rgw_pool& src_pool, const string& src_obj, rgw_pool& dst_pool, string& dst_obj) { if (src_obj.size()) { dst_pool = src_pool; @@ -65,7 +65,7 @@ void RGWSI_SysObj_Cache::normalize_pool_and_obj(rgw_pool& src_pool, const string int RGWSI_SysObj_Cache::remove(RGWSysObjectCtxBase& obj_ctx, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj) + const rgw_raw_obj& obj) { rgw_pool pool; @@ -87,7 +87,7 @@ int RGWSI_SysObj_Cache::remove(RGWSysObjectCtxBase& obj_ctx, int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx, GetObjState& read_state, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, bufferlist *obl, off_t ofs, off_t end, map *attrs, rgw_cache_entry_info *cache_info, @@ -164,7 +164,7 @@ int RGWSI_SysObj_Cache::read(RGWSysObjectCtxBase& obj_ctx, return r; } -int RGWSI_SysObj_Cache::get_attr(rgw_raw_obj& obj, +int RGWSI_SysObj_Cache::get_attr(const rgw_raw_obj& obj, const char *attr_name, bufferlist *dest) { @@ -194,7 +194,7 @@ int RGWSI_SysObj_Cache::get_attr(rgw_raw_obj& obj, return RGWSI_SysObj_Core::get_attr(obj, attr_name, dest); } -int RGWSI_SysObj_Cache::set_attrs(rgw_raw_obj& obj, +int RGWSI_SysObj_Cache::set_attrs(const rgw_raw_obj& obj, map& attrs, map *rmattrs, RGWObjVersionTracker *objv_tracker) @@ -227,7 +227,7 @@ int RGWSI_SysObj_Cache::set_attrs(rgw_raw_obj& obj, return ret; } -int RGWSI_SysObj_Cache::write(rgw_raw_obj& obj, +int RGWSI_SysObj_Cache::write(const rgw_raw_obj& obj, real_time *pmtime, map& attrs, bool exclusive, @@ -278,7 +278,7 @@ int RGWSI_SysObj_Cache::write(rgw_raw_obj& obj, return ret; } -int RGWSI_SysObj_Cache::write_data(rgw_raw_obj& obj, +int RGWSI_SysObj_Cache::write_data(const rgw_raw_obj& obj, const bufferlist& data, bool exclusive, RGWObjVersionTracker *objv_tracker) @@ -311,7 +311,7 @@ int RGWSI_SysObj_Cache::write_data(rgw_raw_obj& obj, return ret; } -int RGWSI_SysObj_Cache::raw_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *pepoch, +int RGWSI_SysObj_Cache::raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *pepoch, map *attrs, bufferlist *first_chunk, RGWObjVersionTracker *objv_tracker) { @@ -371,7 +371,7 @@ done: return 0; } -int RGWSI_SysObj_Cache::distribute_cache(const string& normal_name, rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op) +int RGWSI_SysObj_Cache::distribute_cache(const string& normal_name, const rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op) { RGWCacheNotifyInfo info; diff --git a/src/rgw/services/svc_sys_obj_cache.h b/src/rgw/services/svc_sys_obj_cache.h index 2168abe0eeb..a7d09c48043 100644 --- a/src/rgw/services/svc_sys_obj_cache.h +++ b/src/rgw/services/svc_sys_obj_cache.h @@ -22,7 +22,7 @@ class RGWSI_SysObj_Cache : public RGWSI_SysObj_Core std::shared_ptr cb; - void normalize_pool_and_obj(rgw_pool& src_pool, const string& src_obj, rgw_pool& dst_pool, string& dst_obj); + void normalize_pool_and_obj(const rgw_pool& src_pool, const string& src_obj, rgw_pool& dst_pool, string& dst_obj); protected: void init(std::shared_ptr& _rados_svc, std::shared_ptr& _zone_svc, @@ -33,31 +33,31 @@ protected: int do_start() override; - int raw_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, + int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, map *attrs, bufferlist *first_chunk, RGWObjVersionTracker *objv_tracker) override; int read(RGWSysObjectCtxBase& obj_ctx, GetObjState& read_state, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, bufferlist *bl, off_t ofs, off_t end, map *attrs, rgw_cache_entry_info *cache_info, boost::optional) override; - int get_attr(rgw_raw_obj& obj, const char *name, bufferlist *dest) override; + int get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest) override; - int set_attrs(rgw_raw_obj& obj, + int set_attrs(const rgw_raw_obj& obj, map& attrs, map *rmattrs, RGWObjVersionTracker *objv_tracker); int remove(RGWSysObjectCtxBase& obj_ctx, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj) override; + const rgw_raw_obj& obj) override; - int write(rgw_raw_obj& obj, + int write(const rgw_raw_obj& obj, real_time *pmtime, map& attrs, bool exclusive, @@ -65,12 +65,12 @@ protected: RGWObjVersionTracker *objv_tracker, real_time set_mtime) override; - int write_data(rgw_raw_obj& obj, + int write_data(const rgw_raw_obj& obj, const bufferlist& bl, bool exclusive, RGWObjVersionTracker *objv_tracker); - int distribute_cache(const string& normal_name, rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op); + int distribute_cache(const string& normal_name, const rgw_raw_obj& obj, ObjectCacheInfo& obj_info, int op); int watch_cb(uint64_t notify_id, uint64_t cookie, diff --git a/src/rgw/services/svc_sys_obj_core.cc b/src/rgw/services/svc_sys_obj_core.cc index b8699380262..5e0a8eb40e3 100644 --- a/src/rgw/services/svc_sys_obj_core.cc +++ b/src/rgw/services/svc_sys_obj_core.cc @@ -8,11 +8,14 @@ int RGWSI_SysObj_Core::GetObjState::get_rados_obj(RGWSI_RADOS *rados_svc, RGWSI_Zone *zone_svc, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, RGWSI_RADOS::Obj **pobj) { if (!has_rados_obj) { - zone_svc->canonicalize_raw_obj(&obj); + if (obj.oid.empty()) { + ldout(rados_svc->ctx(), 0) << "ERROR: obj.oid is empty" << dendl; + return -EINVAL; + } rados_obj = rados_svc->obj(obj); int r = rados_obj.open(); @@ -26,10 +29,13 @@ int RGWSI_SysObj_Core::GetObjState::get_rados_obj(RGWSI_RADOS *rados_svc, } int RGWSI_SysObj_Core::get_rados_obj(RGWSI_Zone *zone_svc, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, RGWSI_RADOS::Obj *pobj) { - zone_svc->canonicalize_raw_obj(&obj); + if (obj.oid.empty()) { + ldout(rados_svc->ctx(), 0) << "ERROR: obj.oid is empty" << dendl; + return -EINVAL; + } *pobj = std::move(rados_svc->obj(obj)); int r = pobj->open(); @@ -40,7 +46,7 @@ int RGWSI_SysObj_Core::get_rados_obj(RGWSI_Zone *zone_svc, return 0; } -int RGWSI_SysObj_Core::get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker) +int RGWSI_SysObj_Core::get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker) { if (obj.empty()) { return -EINVAL; @@ -78,7 +84,7 @@ int RGWSI_SysObj_Core::get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, rgw_ return 0; } -int RGWSI_SysObj_Core::get_system_obj_state(RGWSysObjectCtxBase *rctx, rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker) +int RGWSI_SysObj_Core::get_system_obj_state(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker) { int ret; @@ -89,7 +95,7 @@ int RGWSI_SysObj_Core::get_system_obj_state(RGWSysObjectCtxBase *rctx, rgw_raw_o return ret; } -int RGWSI_SysObj_Core::raw_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, +int RGWSI_SysObj_Core::raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, map *attrs, bufferlist *first_chunk, RGWObjVersionTracker *objv_tracker) { @@ -139,7 +145,7 @@ int RGWSI_SysObj_Core::raw_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pm int RGWSI_SysObj_Core::stat(RGWSysObjectCtxBase& obj_ctx, GetObjState& state, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, map *attrs, real_time *lastmod, uint64_t *obj_size, @@ -176,7 +182,7 @@ int RGWSI_SysObj_Core::stat(RGWSysObjectCtxBase& obj_ctx, int RGWSI_SysObj_Core::read(RGWSysObjectCtxBase& obj_ctx, GetObjState& read_state, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, bufferlist *bl, off_t ofs, off_t end, map *attrs, rgw_cache_entry_info *cache_info, @@ -234,7 +240,7 @@ int RGWSI_SysObj_Core::read(RGWSysObjectCtxBase& obj_ctx, * dest: bufferlist to store the result in * Returns: 0 on success, -ERR# otherwise. */ -int RGWSI_SysObj_Core::get_attr(rgw_raw_obj& obj, +int RGWSI_SysObj_Core::get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest) { @@ -257,7 +263,7 @@ int RGWSI_SysObj_Core::get_attr(rgw_raw_obj& obj, return 0; } -int RGWSI_SysObj_Core::set_attrs(rgw_raw_obj& obj, +int RGWSI_SysObj_Core::set_attrs(const rgw_raw_obj& obj, map& attrs, map *rmattrs, RGWObjVersionTracker *objv_tracker) @@ -305,7 +311,7 @@ int RGWSI_SysObj_Core::set_attrs(rgw_raw_obj& obj, return 0; } -int RGWSI_SysObj_Core::omap_get_vals(rgw_raw_obj& obj, +int RGWSI_SysObj_Core::omap_get_vals(const rgw_raw_obj& obj, const string& marker, uint64_t count, std::map *m, @@ -346,7 +352,7 @@ int RGWSI_SysObj_Core::omap_get_vals(rgw_raw_obj& obj, return 0; } -int RGWSI_SysObj_Core::omap_get_all(rgw_raw_obj& obj, std::map *m) +int RGWSI_SysObj_Core::omap_get_all(const rgw_raw_obj& obj, std::map *m) { RGWSI_RADOS::Obj rados_obj; int r = get_rados_obj(zone_svc.get(), obj, &rados_obj); @@ -380,7 +386,7 @@ int RGWSI_SysObj_Core::omap_get_all(rgw_raw_obj& obj, std::map& m, bool must_exist) +int RGWSI_SysObj_Core::omap_set(const rgw_raw_obj& obj, const std::map& m, bool must_exist) { RGWSI_RADOS::Obj rados_obj; int r = get_rados_obj(zone_svc.get(), obj, &rados_obj); @@ -418,7 +424,7 @@ int RGWSI_SysObj_Core::omap_set(rgw_raw_obj& obj, const std::map& attrs, bool exclusive, @@ -545,7 +551,7 @@ int RGWSI_SysObj_Core::write(rgw_raw_obj& obj, } -int RGWSI_SysObj_Core::write_data(rgw_raw_obj& obj, +int RGWSI_SysObj_Core::write_data(const rgw_raw_obj& obj, const bufferlist& bl, bool exclusive, RGWObjVersionTracker *objv_tracker) diff --git a/src/rgw/services/svc_sys_obj_core.h b/src/rgw/services/svc_sys_obj_core.h index d3d897b0c2c..e40f7d704cb 100644 --- a/src/rgw/services/svc_sys_obj_core.h +++ b/src/rgw/services/svc_sys_obj_core.h @@ -112,7 +112,7 @@ protected: int get_rados_obj(RGWSI_RADOS *rados_svc, RGWSI_Zone *zone_svc, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, RGWSI_RADOS::Obj **pobj); }; @@ -122,16 +122,16 @@ protected: rados_svc = _rados_svc; zone_svc = _zone_svc; } - int get_rados_obj(RGWSI_Zone *zone_svc, rgw_raw_obj& obj, RGWSI_RADOS::Obj *pobj); + int get_rados_obj(RGWSI_Zone *zone_svc, const rgw_raw_obj& obj, RGWSI_RADOS::Obj *pobj); - virtual int raw_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, + virtual int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, map *attrs, bufferlist *first_chunk, RGWObjVersionTracker *objv_tracker); virtual int read(RGWSysObjectCtxBase& obj_ctx, GetObjState& read_state, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, bufferlist *bl, off_t ofs, off_t end, map *attrs, rgw_cache_entry_info *cache_info, @@ -139,9 +139,9 @@ protected: virtual int remove(RGWSysObjectCtxBase& obj_ctx, RGWObjVersionTracker *objv_tracker, - rgw_raw_obj& obj); + const rgw_raw_obj& obj); - virtual int write(rgw_raw_obj& obj, + virtual int write(const rgw_raw_obj& obj, real_time *pmtime, map& attrs, bool exclusive, @@ -149,40 +149,40 @@ protected: RGWObjVersionTracker *objv_tracker, real_time set_mtime); - virtual int write_data(rgw_raw_obj& obj, + virtual int write_data(const rgw_raw_obj& obj, const bufferlist& bl, bool exclusive, RGWObjVersionTracker *objv_tracker); - virtual int get_attr(rgw_raw_obj& obj, const char *name, bufferlist *dest); + virtual int get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest); - virtual int set_attrs(rgw_raw_obj& obj, + virtual int set_attrs(const rgw_raw_obj& obj, map& attrs, map *rmattrs, RGWObjVersionTracker *objv_tracker); - virtual int omap_get_all(rgw_raw_obj& obj, std::map *m); - virtual int omap_get_vals(rgw_raw_obj& obj, + virtual int omap_get_all(const rgw_raw_obj& obj, std::map *m); + virtual int omap_get_vals(const rgw_raw_obj& obj, const string& marker, uint64_t count, std::map *m, bool *pmore); - virtual int omap_set(rgw_raw_obj& obj, const std::string& key, bufferlist& bl, bool must_exist = false); - virtual int omap_set(rgw_raw_obj& obj, const map& m, bool must_exist = false); - virtual int omap_del(rgw_raw_obj& obj, const std::string& key); + virtual int omap_set(const rgw_raw_obj& obj, const std::string& key, bufferlist& bl, bool must_exist = false); + virtual int omap_set(const rgw_raw_obj& obj, const map& m, bool must_exist = false); + virtual int omap_del(const rgw_raw_obj& obj, const std::string& key); - virtual int notify(rgw_raw_obj& obj, + virtual int notify(const rgw_raw_obj& obj, bufferlist& bl, uint64_t timeout_ms, bufferlist *pbl); /* wrappers */ - int get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker); - int get_system_obj_state(RGWSysObjectCtxBase *rctx, rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker); + int get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker); + int get_system_obj_state(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker); int stat(RGWSysObjectCtxBase& obj_ctx, GetObjState& state, - rgw_raw_obj& obj, + const rgw_raw_obj& obj, map *attrs, real_time *lastmod, uint64_t *obj_size, diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index 88fc34cb182..920e81d1c9d 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -933,14 +933,6 @@ bool RGWSI_Zone::is_syncing_bucket_meta(const rgw_bucket& bucket) } -void RGWSI_Zone::canonicalize_raw_obj(rgw_raw_obj *obj) -{ - if (obj->oid.empty()) { - obj->oid = obj->pool.to_str(); - obj->pool = zone_params->domain_root; - } -} - int RGWSI_Zone::select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule, string *pselected_rule_name, RGWZonePlacementInfo *rule_info) diff --git a/src/rgw/services/svc_zone.h b/src/rgw/services/svc_zone.h index 1c4d720a81c..bc9ffe12236 100644 --- a/src/rgw/services/svc_zone.h +++ b/src/rgw/services/svc_zone.h @@ -127,8 +127,6 @@ public: int list_realms(list& realms); int list_periods(list& periods); int list_periods(const string& current_period, list& periods); - - void canonicalize_raw_obj(rgw_raw_obj *obj); }; #endif