]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_reshard.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rgw / rgw_reshard.h
index ecb18690fa3fd0c231b31c7a720b72ff950c6472..0cfca38bfb7b421b3604d1523420e40cd66e1cb5 100644 (file)
 
 class RGWReshard;
 namespace rgw { namespace sal {
-  class RGWRadosStore;
+  class RadosStore;
 } }
 
 class RGWBucketReshardLock {
   using Clock = ceph::coarse_mono_clock;
 
-  rgw::sal::RGWRadosStore* store;
+  rgw::sal::RadosStore* store;
   const std::string lock_oid;
   const bool ephemeral;
   rados::cls::lock::Lock internal_lock;
@@ -46,16 +46,16 @@ class RGWBucketReshardLock {
   }
 
 public:
-  RGWBucketReshardLock(rgw::sal::RGWRadosStore* _store,
+  RGWBucketReshardLock(rgw::sal::RadosStore* _store,
                       const std::string& reshard_lock_oid,
                       bool _ephemeral);
-  RGWBucketReshardLock(rgw::sal::RGWRadosStore* _store,
+  RGWBucketReshardLock(rgw::sal::RadosStore* _store,
                       const RGWBucketInfo& bucket_info,
                       bool _ephemeral) :
     RGWBucketReshardLock(_store, bucket_info.bucket.get_key(':'), _ephemeral)
   {}
 
-  int lock();
+  int lock(const DoutPrefixProvider *dpp);
   void unlock();
   int renew(const Clock::time_point&);
 
@@ -73,9 +73,9 @@ public:
 
 private:
 
-  rgw::sal::RGWRadosStore *store;
+  rgw::sal::RadosStore* store;
   RGWBucketInfo bucket_info;
-  std::map<string, bufferlist> bucket_attrs;
+  std::map<std::string, bufferlist> bucket_attrs;
 
   RGWBucketReshardLock reshard_lock;
   RGWBucketReshardLock* outer_reshard_lock;
@@ -91,43 +91,42 @@ private:
                 RGWBucketInfo& new_bucket_info,
                 int max_entries,
                  bool verbose,
-                 ostream *os,
+                 std::ostream *os,
                 Formatter *formatter,
                  const DoutPrefixProvider *dpp);
 public:
 
   // pass nullptr for the final parameter if no outer reshard lock to
   // manage
-  RGWBucketReshard(rgw::sal::RGWRadosStore *_store,
+  RGWBucketReshard(rgw::sal::RadosStore* _store,
                   const RGWBucketInfo& _bucket_info,
-                   const std::map<string, bufferlist>& _bucket_attrs,
+                   const std::map<std::string, bufferlist>& _bucket_attrs,
                   RGWBucketReshardLock* _outer_reshard_lock);
   int execute(int num_shards, int max_op_entries,
               const DoutPrefixProvider *dpp,
-              bool verbose = false, ostream *out = nullptr,
+              bool verbose = false, std::ostream *out = nullptr,
               Formatter *formatter = nullptr,
              RGWReshard *reshard_log = nullptr);
   int get_status(const DoutPrefixProvider *dpp, std::list<cls_rgw_bucket_instance_entry> *status);
   int cancel(const DoutPrefixProvider *dpp);
-  static int clear_resharding(const DoutPrefixProvider *dpp,
-                              rgw::sal::RGWRadosStore* store,
+  static int clear_resharding(const DoutPrefixProvider *dpp, rgw::sal::RadosStore* store,
                              const RGWBucketInfo& bucket_info);
   int clear_resharding(const DoutPrefixProvider *dpp) {
     return clear_resharding(dpp, store, bucket_info);
   }
   static int clear_index_shard_reshard_status(const DoutPrefixProvider *dpp,
-                                              rgw::sal::RGWRadosStore* store,
+                                              rgw::sal::RadosStore* store,
                                              const RGWBucketInfo& bucket_info);
   int clear_index_shard_reshard_status(const DoutPrefixProvider *dpp) {
     return clear_index_shard_reshard_status(dpp, store, bucket_info);
   }
   static int set_resharding_status(const DoutPrefixProvider *dpp,
-                                   rgw::sal::RGWRadosStore* store,
+                                   rgw::sal::RadosStore* store,
                                   const RGWBucketInfo& bucket_info,
-                                  const string& new_instance_id,
+                                  const std::string& new_instance_id,
                                   int32_t num_shards,
                                   cls_rgw_reshard_status status);
-  int set_resharding_status(const DoutPrefixProvider *dpp, const string& new_instance_id,
+  int set_resharding_status(const DoutPrefixProvider *dpp, const std::string& new_instance_id,
                            int32_t num_shards,
                            cls_rgw_reshard_status status) {
     return set_resharding_status(dpp, store, bucket_info,
@@ -197,16 +196,16 @@ public:
     using Clock = ceph::coarse_mono_clock;
 
 private:
-    rgw::sal::RGWRadosStore *store;
-    string lock_name;
+    rgw::sal::RadosStore* store;
+    std::string lock_name;
     rados::cls::lock::Lock instance_lock;
     int num_logshards;
 
     bool verbose;
-    ostream *out;
+    std::ostream *out;
     Formatter *formatter;
 
-    void get_logshard_oid(int shard_num, string *shard);
+    void get_logshard_oid(int shard_num, std::string *shard);
 protected:
   class ReshardWorker : public Thread, public DoutPrefixProvider {
     CephContext *cct;
@@ -231,17 +230,17 @@ protected:
   ReshardWorker *worker = nullptr;
   std::atomic<bool> down_flag = { false };
 
-  string get_logshard_key(const string& tenant, const string& bucket_name);
-  void get_bucket_logshard_oid(const string& tenant, const string& bucket_name, string *oid);
+  std::string get_logshard_key(const std::string& tenant, const std::string& bucket_name);
+  void get_bucket_logshard_oid(const std::string& tenant, const std::string& bucket_name, std::string *oid);
 
 public:
-  RGWReshard(rgw::sal::RGWRadosStore* _store, bool _verbose = false, ostream *_out = nullptr, Formatter *_formatter = nullptr);
+  RGWReshard(rgw::sal::RadosStore* _store, bool _verbose = false, std::ostream *_out = nullptr, Formatter *_formatter = nullptr);
   int add(const DoutPrefixProvider *dpp, cls_rgw_reshard_entry& entry);
   int update(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const RGWBucketInfo& new_bucket_info);
-  int get(cls_rgw_reshard_entry& entry);
+  int get(const DoutPrefixProvider *dpp, cls_rgw_reshard_entry& entry);
   int remove(const DoutPrefixProvider *dpp, cls_rgw_reshard_entry& entry);
-  int list(int logshard_num, string& marker, uint32_t max, std::list<cls_rgw_reshard_entry>& entries, bool *is_truncated);
-  int clear_bucket_resharding(const string& bucket_instance_oid, cls_rgw_reshard_entry& entry);
+  int list(const DoutPrefixProvider *dpp, int logshard_num, std::string& marker, uint32_t max, std::list<cls_rgw_reshard_entry>& entries, bool *is_truncated);
+  int clear_bucket_resharding(const DoutPrefixProvider *dpp, const std::string& bucket_instance_oid, cls_rgw_reshard_entry& entry);
 
   /* reshard thread */
   int process_single_logshard(int logshard_num, const DoutPrefixProvider *dpp);