]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: enforce the std::move semantic across the path of RGWUserBuckets. 17834/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 29 Aug 2017 17:16:20 +0000 (19:16 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 20 Sep 2017 11:18:43 +0000 (13:18 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
(cherry picked from commit 4a7a4344840c873189331f22c8143ba031622d20)

src/rgw/rgw_bucket.h
src/rgw/rgw_common.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h

index 6cc20eb8f6149107e5b6900fc1b85f2c3accb978..69ff714184b5a1212d76f07396e380168d471b4b 100644 (file)
@@ -104,10 +104,14 @@ public:
  */
 class RGWUserBuckets
 {
-  map<string, RGWBucketEnt> buckets;
+  std::map<std::string, RGWBucketEnt> buckets;
 
 public:
-  RGWUserBuckets() {}
+  RGWUserBuckets() = default;
+  RGWUserBuckets(RGWUserBuckets&&) = default;
+
+  RGWUserBuckets& operator=(const RGWUserBuckets&) = default;
+
   void encode(bufferlist& bl) const {
     ::encode(buckets, bl);
   }
index 8d299cf39d475c4818491ec3c6c3fee0ef785d20..b8080e9ab573bca9ba3fab6bad53517b5df7b782 100644 (file)
@@ -774,11 +774,12 @@ struct RGWUserInfo
 WRITE_CLASS_ENCODER(RGWUserInfo)
 
 struct rgw_pool {
-  string name;
-  string ns;
+  std::string name;
+  std::string ns;
 
-  rgw_pool() {}
+  rgw_pool() = default;
   rgw_pool(const rgw_pool& _p) : name(_p.name), ns(_p.ns) {}
+  rgw_pool(rgw_pool&&) = default;
   rgw_pool(const string& _s) {
     from_str(_s);
   }
@@ -834,6 +835,8 @@ struct rgw_pool {
     DECODE_FINISH(bl);
   }
 
+  rgw_pool& operator=(const rgw_pool&) = default;
+
   bool operator==(const rgw_pool& p) const {
     return (compare(p) == 0);
   }
@@ -855,10 +858,20 @@ struct rgw_data_placement_target {
   rgw_pool data_extra_pool;
   rgw_pool index_pool;
 
-  rgw_data_placement_target() {}
+  rgw_data_placement_target() = default;
+  rgw_data_placement_target(const rgw_data_placement_target&) = default;
+  rgw_data_placement_target(rgw_data_placement_target&&) = default;
+
+  rgw_data_placement_target(const rgw_pool& data_pool,
+                            const rgw_pool& data_extra_pool,
+                            const rgw_pool& index_pool)
+    : data_pool(data_pool),
+      data_extra_pool(data_extra_pool),
+      index_pool(index_pool) {
+  }
 
-  rgw_data_placement_target(const rgw_pool& _data_pool, const rgw_pool& _data_extra_pool, const rgw_pool& _index_pool) 
-         : data_pool(_data_pool), data_extra_pool(_data_extra_pool), index_pool(_index_pool) {}
+  rgw_data_placement_target&
+  operator=(const rgw_data_placement_target&) = default;
 
   const rgw_pool& get_data_extra_pool() const {
     if (data_extra_pool.empty()) {
@@ -984,6 +997,8 @@ struct rgw_bucket {
     explicit_placement(b.explicit_placement.data_pool,
                        b.explicit_placement.data_extra_pool,
                        b.explicit_placement.index_pool) {}
+  rgw_bucket(const rgw_bucket&) = default;
+  rgw_bucket(rgw_bucket&&) = default;
 
   void convert(cls_user_bucket *b) const {
     b->name = name;
@@ -1069,6 +1084,8 @@ struct rgw_bucket {
   void decode_json(JSONObj *obj);
   static void generate_test_instances(list<rgw_bucket*>& o);
 
+  rgw_bucket& operator=(const rgw_bucket&) = default;
+
   bool operator<(const rgw_bucket& b) const {
     return name.compare(b.name) < 0;
   }
@@ -1863,7 +1880,15 @@ struct RGWBucketEnt {
   real_time creation_time;
   uint64_t count;
 
-  RGWBucketEnt() : size(0), size_rounded(0), count(0) {}
+  RGWBucketEnt()
+    : size(0),
+      size_rounded(0),
+      count(0) {
+  }
+  RGWBucketEnt(const RGWBucketEnt&) = default;
+  RGWBucketEnt(RGWBucketEnt&&) = default;
+
+  RGWBucketEnt& operator=(const RGWBucketEnt&) = default;
 
   explicit RGWBucketEnt(const rgw_user& u, const cls_user_bucket_entry& e)
     : bucket(u, e.bucket),
index 753a7389235a88b2db41c5654e6a400ab3a589b1..4e092eba42f0a5090d536eb6b1178a17e04c2249 100644 (file)
@@ -1864,7 +1864,7 @@ void RGWListBuckets::execute()
       map<string, RGWBucketEnt>::reverse_iterator riter = m.rbegin();
       marker = riter->first;
 
-      handle_listing_chunk((buckets));
+      handle_listing_chunk(std::move(buckets));
     }
   } while (is_truncated && !done);
 
index 7fe86fade054f79fbd3bff70b201dff73758b5db..25af9fc3d41189ba86629a3f896e426bb7c938ec 100644 (file)
@@ -616,7 +616,7 @@ public:
   void execute() override;
 
   virtual int get_params() = 0;
-  virtual void handle_listing_chunk(RGWUserBuckets& buckets) {
+  virtual void handle_listing_chunk(RGWUserBuckets&& buckets) {
     /* The default implementation, used by e.g. S3, just generates a new
      * part of listing and sends it client immediately. Swift can behave
      * differently: when the reverse option is requested, all incoming
index 9879e1a429b204c89e12d3a25a26b2e2020cc1e6..aa9ce48e2ec42702f2349708035be7208608db67 100644 (file)
@@ -175,7 +175,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)
   }
 }
 
-void RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk(RGWUserBuckets& buckets)
+void RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk(RGWUserBuckets&& buckets)
 {
   if (wants_reversed) {
     /* Just store in the reversal buffer. Its content will be handled later,
index 6cdaef487d9910ec3c73cfefabdd67b0a1d84a8a..c07356203476c53f01e35691808fd52334c1ff58 100644 (file)
@@ -53,7 +53,7 @@ public:
   ~RGWListBuckets_ObjStore_SWIFT() override {}
 
   int get_params() override;
-  void handle_listing_chunk(RGWUserBuckets& buckets) override;
+  void handle_listing_chunk(RGWUserBuckets&& buckets) override;
   void send_response_begin(bool has_buckets) override;
   void send_response_data(RGWUserBuckets& buckets) override;
   void send_response_data_reversed(RGWUserBuckets& buckets);