]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rename some datastructures to signify plurality
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 21 Oct 2019 18:27:31 +0000 (11:27 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:37 +0000 (10:20 -0800)
pipe -> pipes, entity -> entities

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket_sync.cc
src/rgw/rgw_bucket_sync.h
src/rgw/rgw_json_enc.cc
src/rgw/rgw_sync_policy.h

index 2739b0c87f224ea9eb3ad05f7b6c6c8ae337f6bb..e83ca9221d90c7ef8a0a5dd4f742342aaa28108a 100644 (file)
@@ -2330,7 +2330,7 @@ void encode_json(const char *name, const RGWBucketSyncFlowManager::flow_map_t& m
     auto& bucket = entry.first;
     auto& pflow = entry.second;
 
-    encode_json("bucket", rgw_sync_bucket_entity::bucket_key(bucket), f);
+    encode_json("buckets", rgw_sync_bucket_entities::bucket_key(bucket), f);
 #if 0
     {
       Formatter::ArraySection fg(*f, "flow_groups");
@@ -8052,7 +8052,7 @@ next:
 
     auto& group = iter->second;
 
-    rgw_sync_bucket_pipe *pipe;
+    rgw_sync_bucket_pipes *pipe;
 
     group.find_pipe(*opt_pipe_id, true, &pipe);
 
@@ -8092,7 +8092,7 @@ next:
 
     auto& group = iter->second;
 
-    rgw_sync_bucket_pipe *pipe;
+    rgw_sync_bucket_pipes *pipe;
 
     if (!group.find_pipe(*opt_pipe_id, false, &pipe)) {
       cerr << "ERROR: could not find pipe '" << *opt_pipe_id << "'" << std::endl;
index 7cd007cf98bdd8382a18414818785b38db82c49e..dce8839c13d00eb9c3ff7d60bb1975ed7a99e591 100644 (file)
@@ -10,7 +10,7 @@
 #define dout_subsys ceph_subsys_rgw
 
 
-void rgw_sync_bucket_entity::add_zones(const std::vector<string>& new_zones) {
+void rgw_sync_bucket_entities::add_zones(const std::vector<string>& new_zones) {
   for (auto& z : new_zones) {
     if (z == "*") {
       all_zones = true;
@@ -26,7 +26,7 @@ void rgw_sync_bucket_entity::add_zones(const std::vector<string>& new_zones) {
   }
 }
 
-void rgw_sync_bucket_entity::remove_zones(const std::vector<string>& rm_zones) {
+void rgw_sync_bucket_entities::remove_zones(const std::vector<string>& rm_zones) {
   all_zones = false;
 
   if (!zones) {
@@ -49,7 +49,7 @@ static void set_bucket_field(std::optional<string> source, string *field) {
   *field = *source;
 }
 
-void rgw_sync_bucket_entity::set_bucket(std::optional<string> tenant,
+void rgw_sync_bucket_entities::set_bucket(std::optional<string> tenant,
                 std::optional<string> bucket_name,
                 std::optional<string> bucket_id)
 {
@@ -68,7 +68,7 @@ void rgw_sync_bucket_entity::set_bucket(std::optional<string> tenant,
   }
 }
 
-void rgw_sync_bucket_entity::remove_bucket(std::optional<string> tenant,
+void rgw_sync_bucket_entities::remove_bucket(std::optional<string> tenant,
                                            std::optional<string> bucket_name,
                                            std::optional<string> bucket_id)
 {
@@ -94,7 +94,7 @@ void rgw_sync_bucket_entity::remove_bucket(std::optional<string> tenant,
 }
 
 
-string rgw_sync_bucket_entity::bucket_key(std::optional<rgw_bucket> b)
+string rgw_sync_bucket_entities::bucket_key(std::optional<rgw_bucket> b)
 {
   if (!b) {
     return string("*");
@@ -217,7 +217,7 @@ void rgw_sync_data_flow_group::remove_directional(const string& source_zone, con
   }
 }
 
-bool rgw_sync_policy_group::find_pipe(const string& pipe_id, bool create, rgw_sync_bucket_pipe **pipe)
+bool rgw_sync_policy_group::find_pipe(const string& pipe_id, bool create, rgw_sync_bucket_pipes **pipe)
 {
   for (auto& p : pipes) {
     if (pipe_id == p.id) {
@@ -247,11 +247,11 @@ void rgw_sync_policy_group::remove_pipe(const string& pipe_id)
   }
 }
 
-static std::vector<rgw_sync_bucket_pipe> filter_relevant_pipes(const std::vector<rgw_sync_bucket_pipe>& pipes,
+static std::vector<rgw_sync_bucket_pipes> filter_relevant_pipes(const std::vector<rgw_sync_bucket_pipes>& pipes,
                                                                const string& source_zone,
                                                                const string& dest_zone)
 {
-  std::vector<rgw_sync_bucket_pipe> relevant_pipes;
+  std::vector<rgw_sync_bucket_pipes> relevant_pipes;
   for (auto& pipe : pipes) {
     if (pipe.source.match_zone(source_zone) &&
         pipe.dest.match_zone(dest_zone)) {
@@ -270,23 +270,23 @@ static bool is_wildcard_bucket(const rgw_bucket& bucket)
 void rgw_sync_group_pipe_map::zone_bucket::dump(ceph::Formatter *f) const
 {
   encode_json("zone", zone, f);
-  encode_json("bucket", rgw_sync_bucket_entity::bucket_key(bucket), f);
+  encode_json("buckets", rgw_sync_bucket_entities::bucket_key(bucket), f);
 }
 
 void rgw_sync_group_pipe_map::dump(ceph::Formatter *f) const
 {
   encode_json("zone", zone, f);
-  encode_json("bucket", rgw_sync_bucket_entity::bucket_key(bucket), f);
+  encode_json("buckets", rgw_sync_bucket_entities::bucket_key(bucket), f);
   encode_json("sources", sources, f);
   encode_json("dests", dests, f);
 }
 
-ostream& operator<<(ostream& os, const rgw_sync_bucket_entity& e) {
-  os << "{b=" << rgw_sync_bucket_entity::bucket_key(e.bucket) << ",z=" << e.zones.value_or(std::set<string>()) << "}";
+ostream& operator<<(ostream& os, const rgw_sync_bucket_entities& e) {
+  os << "{b=" << rgw_sync_bucket_entities::bucket_key(e.bucket) << ",z=" << e.zones.value_or(std::set<string>()) << "}";
   return os;
 }
 
-ostream& operator<<(ostream& os, const rgw_sync_bucket_pipe& pipe) {
+ostream& operator<<(ostream& os, const rgw_sync_bucket_pipes& pipe) {
   os << "{id=" << pipe.id << ",s=" << pipe.source << ",d=" << pipe.dest << "}";
   return os;
 }
@@ -295,7 +295,7 @@ ostream& operator<<(ostream& os, const rgw_sync_bucket_pipe& pipe) {
 template <typename CB1, typename CB2>
 void rgw_sync_group_pipe_map::try_add_to_pipe_map(const string& source_zone,
                                                   const string& dest_zone,
-                                                  const std::vector<rgw_sync_bucket_pipe>& pipes,
+                                                  const std::vector<rgw_sync_bucket_pipes>& pipes,
                                                   zb_pipe_map_t *pipe_map,
                                                   CB1 filter_cb,
                                                   CB2 call_filter_cb)
@@ -317,13 +317,13 @@ void rgw_sync_group_pipe_map::try_add_to_pipe_map(const string& source_zone,
 template <typename CB>
 void rgw_sync_group_pipe_map::try_add_source(const string& source_zone,
                   const string& dest_zone,
-                  const std::vector<rgw_sync_bucket_pipe>& pipes,
+                  const std::vector<rgw_sync_bucket_pipes>& pipes,
                   CB filter_cb)
 {
   return try_add_to_pipe_map(source_zone, dest_zone, pipes,
                              &sources,
                              filter_cb,
-                             [&](const rgw_sync_bucket_pipe& pipe, zone_bucket *zb) {
+                             [&](const rgw_sync_bucket_pipes& pipe, zone_bucket *zb) {
                              *zb = zone_bucket{source_zone, pipe.source.get_bucket()};
                              return filter_cb(source_zone, zb->bucket, dest_zone, pipe.dest.get_bucket());
                              });
@@ -332,13 +332,13 @@ void rgw_sync_group_pipe_map::try_add_source(const string& source_zone,
 template <typename CB>
 void rgw_sync_group_pipe_map::try_add_dest(const string& source_zone,
                                            const string& dest_zone,
-                                           const std::vector<rgw_sync_bucket_pipe>& pipes,
+                                           const std::vector<rgw_sync_bucket_pipes>& pipes,
                                            CB filter_cb)
 {
   return try_add_to_pipe_map(source_zone, dest_zone, pipes,
                              &dests,
                              filter_cb,
-                             [&](const rgw_sync_bucket_pipe& pipe, zone_bucket *zb) {
+                             [&](const rgw_sync_bucket_pipes& pipe, zone_bucket *zb) {
                              *zb = zone_bucket{dest_zone, pipe.dest.get_bucket()};
                              return filter_cb(source_zone, pipe.source.get_bucket(), dest_zone, zb->bucket);
                              });
@@ -380,7 +380,7 @@ void rgw_sync_group_pipe_map::init(const string& _zone,
 
   status = group.status;
 
-  std::vector<rgw_sync_bucket_pipe> zone_pipes;
+  std::vector<rgw_sync_bucket_pipes> zone_pipes;
 
   /* only look at pipes that touch the specific zone and bucket */
   for (auto& pipe : group.pipes) {
@@ -424,10 +424,10 @@ void rgw_sync_group_pipe_map::init(const string& _zone,
 /*
  * find all relevant pipes in our zone that match {dest_bucket} <- {source_zone, source_bucket}
  */
-vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_source_pipes(const string& source_zone,
+vector<rgw_sync_bucket_pipes> rgw_sync_group_pipe_map::find_source_pipes(const string& source_zone,
                                                                         std::optional<rgw_bucket> source_bucket,
                                                                         std::optional<rgw_bucket> dest_bucket) {
-  vector<rgw_sync_bucket_pipe> result;
+  vector<rgw_sync_bucket_pipes> result;
 
   auto range = find_pipes(sources, source_zone, source_bucket);
 
@@ -444,10 +444,10 @@ vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_source_pipes(const st
  * find all relevant pipes in other zones that pull from a specific
  * source bucket in out zone {source_bucket} -> {dest_zone, dest_bucket}
  */
-vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_dest_pipes(std::optional<rgw_bucket> source_bucket,
+vector<rgw_sync_bucket_pipes> rgw_sync_group_pipe_map::find_dest_pipes(std::optional<rgw_bucket> source_bucket,
                                                                       const string& dest_zone,
                                                                       std::optional<rgw_bucket> dest_bucket) {
-  vector<rgw_sync_bucket_pipe> result;
+  vector<rgw_sync_bucket_pipes> result;
 
   auto range = find_pipes(dests, dest_zone, dest_bucket);
 
@@ -464,7 +464,7 @@ vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_dest_pipes(std::optio
 /*
  * find all relevant pipes from {source_zone, source_bucket} -> {dest_zone, dest_bucket}
  */
-vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_pipes(const string& source_zone,
+vector<rgw_sync_bucket_pipes> rgw_sync_group_pipe_map::find_pipes(const string& source_zone,
                                                                  std::optional<rgw_bucket> source_bucket,
                                                                  const string& dest_zone,
                                                                  std::optional<rgw_bucket> dest_bucket) {
@@ -476,7 +476,7 @@ vector<rgw_sync_bucket_pipe> rgw_sync_group_pipe_map::find_pipes(const string& s
     return find_dest_pipes(source_bucket, dest_zone, dest_bucket);
   }
 
-  return vector<rgw_sync_bucket_pipe>();
+  return vector<rgw_sync_bucket_pipes>();
 }
 
 void RGWBucketSyncFlowManager::pipe_flow::dump(ceph::Formatter *f) const
@@ -549,7 +549,7 @@ RGWBucketSyncFlowManager::flow_map_t::iterator RGWBucketSyncFlowManager::find_bu
 }
 
 
-void RGWBucketSyncFlowManager::update_flow_maps(const rgw_sync_bucket_pipe& pipe) {
+void RGWBucketSyncFlowManager::update_flow_maps(const rgw_sync_bucket_pipes& pipe) {
   auto source_bucket = pipe.source.get_bucket();
   auto dest_bucket = pipe.dest.get_bucket();
 
@@ -581,7 +581,7 @@ void RGWBucketSyncFlowManager::update_flow_maps(const rgw_sync_bucket_pipe& pipe
 }
 
 void RGWBucketSyncFlowManager::init(const rgw_sync_policy_info& sync_policy) {
-    rgw_sync_bucket_entity entity;
+    rgw_sync_bucket_entities entity;
     entity.zones = std::set<string>( { zone_name } );
     entity.bucket =  bucket;
 
@@ -605,8 +605,8 @@ void RGWBucketSyncFlowManager::init(const rgw_sync_policy_info& sync_policy) {
                         });
 
     for (auto& entry : flow_group_map.sources) {
-      rgw_sync_bucket_pipe pipe;
-      rgw_sync_bucket_entity source;
+      rgw_sync_bucket_pipes pipe;
+      rgw_sync_bucket_entities source;
       pipe.source.zones = std::set<string>( { entry.first.zone } );
       pipe.source.bucket = entry.first.bucket;
       pipe.dest = entity;
@@ -616,8 +616,8 @@ void RGWBucketSyncFlowManager::init(const rgw_sync_policy_info& sync_policy) {
     }
 
     for (auto& entry : flow_group_map.dests) {
-      rgw_sync_bucket_pipe pipe;
-      rgw_sync_bucket_entity dest;
+      rgw_sync_bucket_pipes pipe;
+      rgw_sync_bucket_entities dest;
       pipe.dest.zones = std::set<string>( { entry.first.zone } );
       pipe.dest.bucket = entry.first.bucket;
       pipe.source = entity;
@@ -637,7 +637,7 @@ void RGWBucketSyncFlowManager::init(const rgw_sync_policy_info& sync_policy) {
         update_flow_maps(pipe, flow_group_map);
       }
     } else {
-      update_flow_maps(rgw_sync_bucket_pipe(), flow_group_map);
+      update_flow_maps(rgw_sync_bucket_pipes(), flow_group_map);
     }
   }
 #endif
index b6d3f4400f2445f8a684f5659701fbd9b3067286..e8b1af9d194c8084f0f01bdabfef07ffeaf3fc09 100644 (file)
@@ -21,7 +21,7 @@
 
 class RGWSI_Zone;
 struct rgw_sync_group_pipe_map;
-struct rgw_sync_bucket_pipe;
+struct rgw_sync_bucket_pipes;
 struct rgw_sync_policy_info;
 
 struct rgw_sync_group_pipe_map {
@@ -52,7 +52,7 @@ struct rgw_sync_group_pipe_map {
     void dump(ceph::Formatter *f) const;
   };
 
-  using zb_pipe_map_t = std::multimap<zone_bucket, rgw_sync_bucket_pipe>;
+  using zb_pipe_map_t = std::multimap<zone_bucket, rgw_sync_bucket_pipes>;
 
   zb_pipe_map_t sources; /* all the pipes where zone is pulling from */
   zb_pipe_map_t dests; /* all the pipes that pull from zone */
@@ -62,7 +62,7 @@ struct rgw_sync_group_pipe_map {
   template <typename CB1, typename CB2>
   void try_add_to_pipe_map(const string& source_zone,
                            const string& dest_zone,
-                           const std::vector<rgw_sync_bucket_pipe>& pipes,
+                           const std::vector<rgw_sync_bucket_pipes>& pipes,
                            zb_pipe_map_t *pipe_map,
                            CB1 filter_cb,
                            CB2 call_filter_cb);
@@ -70,13 +70,13 @@ struct rgw_sync_group_pipe_map {
   template <typename CB>
   void try_add_source(const string& source_zone,
                   const string& dest_zone,
-                  const std::vector<rgw_sync_bucket_pipe>& pipes,
+                  const std::vector<rgw_sync_bucket_pipes>& pipes,
                   CB filter_cb);
           
   template <typename CB>
   void try_add_dest(const string& source_zone,
                   const string& dest_zone,
-                  const std::vector<rgw_sync_bucket_pipe>& pipes,
+                  const std::vector<rgw_sync_bucket_pipes>& pipes,
                   CB filter_cb);
           
   pair<zb_pipe_map_t::const_iterator, zb_pipe_map_t::const_iterator> find_pipes(const zb_pipe_map_t& m,
@@ -92,7 +92,7 @@ struct rgw_sync_group_pipe_map {
   /*
    * find all relevant pipes in our zone that match {dest_bucket} <- {source_zone, source_bucket}
    */
-  vector<rgw_sync_bucket_pipe> find_source_pipes(const string& source_zone,
+  vector<rgw_sync_bucket_pipes> find_source_pipes(const string& source_zone,
                                                  std::optional<rgw_bucket> source_bucket,
                                                  std::optional<rgw_bucket> dest_bucket);
 
@@ -100,14 +100,14 @@ struct rgw_sync_group_pipe_map {
    * find all relevant pipes in other zones that pull from a specific
    * source bucket in out zone {source_bucket} -> {dest_zone, dest_bucket}
    */
-  vector<rgw_sync_bucket_pipe> find_dest_pipes(std::optional<rgw_bucket> source_bucket,
+  vector<rgw_sync_bucket_pipes> find_dest_pipes(std::optional<rgw_bucket> source_bucket,
                                                  const string& dest_zone,
                                                  std::optional<rgw_bucket> dest_bucket);
 
   /*
    * find all relevant pipes from {source_zone, source_bucket} -> {dest_zone, dest_bucket}
    */
-  vector<rgw_sync_bucket_pipe> find_pipes(const string& source_zone,
+  vector<rgw_sync_bucket_pipes> find_pipes(const string& source_zone,
                                           std::optional<rgw_bucket> source_bucket,
                                           const string& dest_zone,
                                           std::optional<rgw_bucket> dest_bucket);
@@ -116,7 +116,7 @@ struct rgw_sync_group_pipe_map {
 class RGWBucketSyncFlowManager {
 public:
   struct pipe_flow {
-    std::vector<rgw_sync_bucket_pipe> pipe;
+    std::vector<rgw_sync_bucket_pipes> pipe;
 
     void dump(ceph::Formatter *f) const;
   };
@@ -146,7 +146,7 @@ private:
    */
   flow_map_t::iterator find_bucket_flow(flow_map_t& m, std::optional<rgw_bucket> bucket);
 
-  void update_flow_maps(const rgw_sync_bucket_pipe& pipe);
+  void update_flow_maps(const rgw_sync_bucket_pipes& pipe);
 
 public:
 
index fa7c00e12aee3e38fe9889c19c74c37457efc7cf..ba3d574d4a4595453660730c4cbc73796a883335 100644 (file)
@@ -865,9 +865,9 @@ void rgw_sync_symmetric_group::decode_json(JSONObj *obj)
   JSONDecoder::decode_json("zones", zones, obj);
 }
 
-void rgw_sync_bucket_entity::dump(Formatter *f) const
+void rgw_sync_bucket_entities::dump(Formatter *f) const
 {
-  encode_json("bucket", rgw_sync_bucket_entity::bucket_key(bucket), f);
+  encode_json("bucket", rgw_sync_bucket_entities::bucket_key(bucket), f);
   if (zones) {
     encode_json("zones", zones, f);
   } else if (all_zones) {
@@ -876,7 +876,7 @@ void rgw_sync_bucket_entity::dump(Formatter *f) const
   }
 }
 
-void rgw_sync_bucket_entity::decode_json(JSONObj *obj)
+void rgw_sync_bucket_entities::decode_json(JSONObj *obj)
 {
   string s;
   JSONDecoder::decode_json("bucket", s, obj);
@@ -903,14 +903,14 @@ void rgw_sync_bucket_entity::decode_json(JSONObj *obj)
   JSONDecoder::decode_json("zones", zones, obj);
 }
 
-void rgw_sync_bucket_pipe::dump(Formatter *f) const
+void rgw_sync_bucket_pipes::dump(Formatter *f) const
 {
   encode_json("id", id, f);
   encode_json("source", source, f);
   encode_json("dest", dest, f);
 }
 
-void rgw_sync_bucket_pipe::decode_json(JSONObj *obj)
+void rgw_sync_bucket_pipes::decode_json(JSONObj *obj)
 {
   JSONDecoder::decode_json("id", id, obj);
   JSONDecoder::decode_json("source", source, obj);
index fdb803fd75cda6a9f3c3f3ac2a17d7cc58d0a020..30513895a737c1f3de33f8f1ecc3ec1b4f380037 100644 (file)
@@ -219,7 +219,7 @@ struct rgw_sync_directional_rule {
 };
 WRITE_CLASS_ENCODER(rgw_sync_directional_rule)
 
-struct rgw_sync_bucket_entity {
+struct rgw_sync_bucket_entities {
 private:
   bool match_str(const string& s1, const string& s2) const { /* empty string is wildcard */
     return (s1.empty() ||
@@ -291,9 +291,9 @@ public:
 
   static string bucket_key(std::optional<rgw_bucket> b);
 };
-WRITE_CLASS_ENCODER(rgw_sync_bucket_entity)
+WRITE_CLASS_ENCODER(rgw_sync_bucket_entities)
 
-struct rgw_sync_bucket_pipe {
+struct rgw_sync_bucket_pipes {
 private:
   void symmetrical_copy_if_empty(string& s1, string& s2) const {
     if (s1.empty()) {
@@ -305,8 +305,8 @@ private:
 
 public:
   string id;
-  rgw_sync_bucket_entity source;
-  rgw_sync_bucket_entity dest;
+  rgw_sync_bucket_entities source;
+  rgw_sync_bucket_entities dest;
 
   void encode(bufferlist& bl) const {
     ENCODE_START(1, 1, bl);
@@ -358,7 +358,7 @@ public:
     }
   }
 };
-WRITE_CLASS_ENCODER(rgw_sync_bucket_pipe)
+WRITE_CLASS_ENCODER(rgw_sync_bucket_pipes)
 
 /*
  * define data flow between zones. Symmetrical: zones sync from each other.
@@ -403,7 +403,7 @@ struct rgw_sync_policy_group {
 
   rgw_sync_data_flow_group data_flow; /* override data flow, howver, will not be able to
                                                         add new flows that don't exist at higher level */
-  std::vector<rgw_sync_bucket_pipe> pipes; /* if not defined then applies to all
+  std::vector<rgw_sync_bucket_pipes> pipes; /* if not defined then applies to all
                                                               buckets (DR sync) */
 
   enum Status {
@@ -451,7 +451,7 @@ struct rgw_sync_policy_group {
     return true;
   }
 
-  bool find_pipe(const string& pipe_id, bool create, rgw_sync_bucket_pipe **pipe);
+  bool find_pipe(const string& pipe_id, bool create, rgw_sync_bucket_pipes **pipe);
   void remove_pipe(const string& pipe_id);
 };
 WRITE_CLASS_ENCODER(rgw_sync_policy_group)