X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frgw%2Frgw_orphan.h;h=a5081374e88fdb44a4691c66c63bf681758a35de;hb=20effc670b57271cb089376d6d0800990e5218d5;hp=34680d25a467aede524df1ebdecd12b3ec5c3cd6;hpb=a71831dadd1e1f3e0fa70405511f65cc33db0498;p=ceph.git diff --git a/ceph/src/rgw/rgw_orphan.h b/ceph/src/rgw/rgw_orphan.h index 34680d25a..a5081374e 100644 --- a/ceph/src/rgw/rgw_orphan.h +++ b/ceph/src/rgw/rgw_orphan.h @@ -19,7 +19,7 @@ #include "common/Formatter.h" #include "common/errno.h" -#include "rgw_sal.h" +#include "rgw_sal_rados.h" #define dout_subsys ceph_subsys_rgw @@ -40,11 +40,11 @@ enum RGWOrphanSearchStageId { struct RGWOrphanSearchStage { RGWOrphanSearchStageId stage; int shard; - string marker; + std::string marker; RGWOrphanSearchStage() : stage(ORPHAN_SEARCH_STAGE_UNKNOWN), shard(0) {} explicit RGWOrphanSearchStage(RGWOrphanSearchStageId _stage) : stage(_stage), shard(0) {} - RGWOrphanSearchStage(RGWOrphanSearchStageId _stage, int _shard, const string& _marker) : stage(_stage), shard(_shard), marker(_marker) {} + RGWOrphanSearchStage(RGWOrphanSearchStageId _stage, int _shard, const std::string& _marker) : stage(_stage), shard(_shard), marker(_marker) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); @@ -69,7 +69,7 @@ struct RGWOrphanSearchStage { WRITE_CLASS_ENCODER(RGWOrphanSearchStage) struct RGWOrphanSearchInfo { - string job_name; + std::string job_name; rgw_pool pool; uint16_t num_shards; utime_t start_time; @@ -86,7 +86,7 @@ struct RGWOrphanSearchInfo { void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(job_name, bl); - string s; + std::string s; decode(s, bl); pool.from_str(s); decode(num_shards, bl); @@ -123,42 +123,42 @@ struct RGWOrphanSearchState { WRITE_CLASS_ENCODER(RGWOrphanSearchState) class RGWOrphanStore { - rgw::sal::RGWRadosStore *store; + rgw::sal::RadosStore* store; librados::IoCtx ioctx; - string oid; + std::string oid; public: - explicit RGWOrphanStore(rgw::sal::RGWRadosStore *_store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {} + explicit RGWOrphanStore(rgw::sal::RadosStore* _store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {} librados::IoCtx& get_ioctx() { return ioctx; } int init(const DoutPrefixProvider *dpp); - int read_job(const string& job_name, RGWOrphanSearchState& state); - int write_job(const string& job_name, const RGWOrphanSearchState& state); - int remove_job(const string& job_name); - int list_jobs(map &job_list); + int read_job(const std::string& job_name, RGWOrphanSearchState& state); + int write_job(const std::string& job_name, const RGWOrphanSearchState& state); + int remove_job(const std::string& job_name); + int list_jobs(std::map &job_list); - int store_entries(const DoutPrefixProvider *dpp, const string& oid, const map& entries); - int read_entries(const string& oid, const string& marker, map *entries, bool *truncated); + int store_entries(const DoutPrefixProvider *dpp, const std::string& oid, const std::map& entries); + int read_entries(const std::string& oid, const std::string& marker, std::map *entries, bool *truncated); }; class RGWOrphanSearch { - rgw::sal::RGWRadosStore *store; + rgw::sal::RadosStore* store; RGWOrphanStore orphan_store; RGWOrphanSearchInfo search_info; RGWOrphanSearchStage search_stage; - map all_objs_index; - map buckets_instance_index; - map linked_objs_index; + std::map all_objs_index; + std::map buckets_instance_index; + std::map linked_objs_index; - string index_objs_prefix; + std::string index_objs_prefix; uint16_t max_concurrent_ios; uint64_t stale_secs; @@ -167,25 +167,24 @@ class RGWOrphanSearch { bool detailed_mode; struct log_iter_info { - string oid; - list::iterator cur; - list::iterator end; + std::string oid; + std::list::iterator cur; + std::list::iterator end; }; - int log_oids(const DoutPrefixProvider *dpp, map& log_shards, map >& oids); + int log_oids(const DoutPrefixProvider *dpp, std::map& log_shards, std::map >& oids); #define RGW_ORPHANSEARCH_HASH_PRIME 7877 - int orphan_shard(const string& str) { + int orphan_shard(const std::string& str) { return ceph_str_hash_linux(str.c_str(), str.size()) % RGW_ORPHANSEARCH_HASH_PRIME % search_info.num_shards; } - int handle_stat_result(const DoutPrefixProvider *dpp, map >& oids, RGWRados::Object::Stat::Result& result); - int pop_and_handle_stat_op(const DoutPrefixProvider *dpp, map >& oids, std::deque& ops); + int handle_stat_result(const DoutPrefixProvider *dpp, std::map >& oids, RGWRados::Object::Stat::Result& result); + int pop_and_handle_stat_op(const DoutPrefixProvider *dpp, std::map >& oids, std::deque& ops); - - int remove_index(map& index); + int remove_index(std::map& index); public: - RGWOrphanSearch(rgw::sal::RGWRadosStore *_store, int _max_ios, uint64_t _stale_secs) : store(_store), orphan_store(store), max_concurrent_ios(_max_ios), stale_secs(_stale_secs) {} + RGWOrphanSearch(rgw::sal::RadosStore* _store, int _max_ios, uint64_t _stale_secs) : store(_store), orphan_store(store), max_concurrent_ios(_max_ios), stale_secs(_stale_secs) {} int save_state() { RGWOrphanSearchState state; @@ -194,13 +193,13 @@ public: return orphan_store.write_job(search_info.job_name, state); } - int init(const DoutPrefixProvider *dpp, const string& job_name, RGWOrphanSearchInfo *info, bool _detailed_mode=false); + int init(const DoutPrefixProvider *dpp, const std::string& job_name, RGWOrphanSearchInfo *info, bool _detailed_mode=false); - int create(const string& job_name, int num_shards); + int create(const std::string& job_name, int num_shards); int build_all_oids_index(const DoutPrefixProvider *dpp); int build_buckets_instance_index(const DoutPrefixProvider *dpp); - int build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map >& oids); + int build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const std::string& bucket_instance_id, std::map >& oids); int build_linked_oids_index(const DoutPrefixProvider *dpp); int compare_oid_indexes(const DoutPrefixProvider *dpp); @@ -251,7 +250,7 @@ class RGWRadosList { p.first->second.filter_keys.insert(obj_key); } - rgw::sal::RGWRadosStore* store; + rgw::sal::RadosStore* store; uint16_t max_concurrent_ios; uint64_t stale_secs; @@ -260,18 +259,18 @@ class RGWRadosList { bool include_rgw_obj_name; std::string field_separator; - int handle_stat_result(const DoutPrefixProvider *dpp, - RGWRados::Object::Stat::Result& result, + int handle_stat_result(const DoutPrefixProvider *dpp, + RGWRados::Object::Stat::Result& result, std::string& bucket_name, rgw_obj_key& obj_key, - std::set& obj_oids); - int pop_and_handle_stat_op(const DoutPrefixProvider *dpp, + std::set& obj_oids); + int pop_and_handle_stat_op(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, std::deque& ops); public: - RGWRadosList(rgw::sal::RGWRadosStore* _store, + RGWRadosList(rgw::sal::RadosStore* _store, int _max_ios, uint64_t _stale_secs, const std::string& _tenant_name) : @@ -287,9 +286,8 @@ public: const std::string& prefix, const std::set& entries_filter); - int do_incomplete_multipart(const DoutPrefixProvider *dpp, - rgw::sal::RGWRadosStore* store, - RGWBucketInfo& bucket_info); + int do_incomplete_multipart(const DoutPrefixProvider *dpp, + rgw::sal::Bucket* bucket); int build_linked_oids_index();