]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls/fifo: Use spaceship operator to implement comparisons
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 30 Nov 2022 21:18:31 +0000 (16:18 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 9 Jan 2023 18:23:44 +0000 (13:23 -0500)
Except for the version type, where only versions with the same tag are
comparable.

Fixes: https://tracker.ceph.com/issues/57562
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/cls/fifo/cls_fifo_types.h

index cc02a5dcd45d19da71c02c08269b14608a2516b8..5c7e6769ea3a93b67c8137e44f5caba6fb8bbf9f 100644 (file)
@@ -105,11 +105,7 @@ struct data_params {
   void dump(ceph::Formatter* f) const;
   void decode_json(JSONObj* obj);
 
-  bool operator ==(const data_params& rhs) const {
-    return (max_part_size == rhs.max_part_size &&
-           max_entry_size == rhs.max_entry_size &&
-           full_size_threshold == rhs.full_size_threshold);
-  }
+  auto operator <=>(const data_params&) const = default;
 };
 WRITE_CLASS_ENCODER(data_params)
 inline std::ostream& operator <<(std::ostream& m, const data_params& d) {
@@ -152,10 +148,7 @@ struct journal_entry {
   }
   void dump(ceph::Formatter* f) const;
 
-  friend bool operator ==(const journal_entry& lhs, const journal_entry& rhs) {
-    return (lhs.op == rhs.op &&
-           lhs.part_num == rhs.part_num);
-  }
+  auto operator <=>(const journal_entry&) const = default;
 };
 WRITE_CLASS_ENCODER(journal_entry)
 inline std::ostream& operator <<(std::ostream& m, const journal_entry::Op& o) {