From: Casey Bodley Date: Thu, 10 Feb 2022 22:04:05 +0000 (-0500) Subject: rgw: add comparison operators for index layout types X-Git-Tag: v18.0.0~787^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f683177b11149bdf439e77b25b539a96f4d7ed47;p=ceph.git rgw: add comparison operators for index layout types Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_bucket_layout.h b/src/rgw/rgw_bucket_layout.h index 74d9fe12149..f1fe3fcf866 100644 --- a/src/rgw/rgw_bucket_layout.h +++ b/src/rgw/rgw_bucket_layout.h @@ -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);