]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add comparison operators for index layout types
authorCasey Bodley <cbodley@redhat.com>
Thu, 10 Feb 2022 22:04:05 +0000 (17:04 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 27 May 2022 19:47:33 +0000 (15:47 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_bucket_layout.h

index 74d9fe12149a535d6d3c3133e140d4803c95a08c..f1fe3fcf86643622616e68d806025080c61116fc 100644 (file)
@@ -52,6 +52,17 @@ struct bucket_index_normal_layout {
   BucketHashType hash_type = BucketHashType::Mod;
 };
 
+
+inline bool operator==(const bucket_index_normal_layout& l,
+                       const bucket_index_normal_layout& r) {
+  return l.num_shards == r.num_shards
+      && l.hash_type == r.hash_type;
+}
+inline bool operator!=(const bucket_index_normal_layout& l,
+                       const bucket_index_normal_layout& r) {
+  return !(l == r);
+}
+
 void encode(const bucket_index_normal_layout& l, bufferlist& bl, uint64_t f=0);
 void decode(bucket_index_normal_layout& l, bufferlist::const_iterator& bl);
 void encode_json_impl(const char *name, const bucket_index_normal_layout& l, ceph::Formatter *f);
@@ -64,6 +75,15 @@ struct bucket_index_layout {
   bucket_index_normal_layout normal;
 };
 
+inline bool operator==(const bucket_index_layout& l,
+                       const bucket_index_layout& r) {
+  return l.type == r.type && l.normal == r.normal;
+}
+inline bool operator!=(const bucket_index_layout& l,
+                       const bucket_index_layout& r) {
+  return !(l == r);
+}
+
 void encode(const bucket_index_layout& l, bufferlist& bl, uint64_t f=0);
 void decode(bucket_index_layout& l, bufferlist::const_iterator& bl);
 void encode_json_impl(const char *name, const bucket_index_layout& l, ceph::Formatter *f);
@@ -74,6 +94,15 @@ struct bucket_index_layout_generation {
   bucket_index_layout layout;
 };
 
+inline bool operator==(const bucket_index_layout_generation& l,
+                       const bucket_index_layout_generation& r) {
+  return l.gen == r.gen && l.layout == r.layout;
+}
+inline bool operator!=(const bucket_index_layout_generation& l,
+                       const bucket_index_layout_generation& r) {
+  return !(l == r);
+}
+
 void encode(const bucket_index_layout_generation& l, bufferlist& bl, uint64_t f=0);
 void decode(bucket_index_layout_generation& l, bufferlist::const_iterator& bl);
 void encode_json_impl(const char *name, const bucket_index_layout_generation& l, ceph::Formatter *f);