]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add == and != operators for period history cursor
authorCasey Bodley <cbodley@redhat.com>
Tue, 23 Aug 2016 02:06:15 +0000 (22:06 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 26 Apr 2017 12:51:01 +0000 (08:51 -0400)
RGWMetaSyncCR was using operator== but it always returned true!

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_period_history.cc
src/rgw/rgw_period_history.h

index eff0e78ad9dee2fef48b3919acff79f34c4cd218..895700f6897bc17244558d8f3035e00ca74bb3f9 100644 (file)
@@ -69,6 +69,15 @@ bool Cursor::has_next() const
   return epoch < history->get_newest_epoch();
 }
 
+bool operator==(const Cursor& lhs, const Cursor& rhs)
+{
+  return lhs.history == rhs.history && lhs.epoch == rhs.epoch;
+}
+
+bool operator!=(const Cursor& lhs, const Cursor& rhs)
+{
+  return !(lhs == rhs);
+}
 
 class RGWPeriodHistory::Impl final {
  public:
index 9541493aa1427f0e4dd88c7175e1497eaeb25237..0796c6116b5ce233520da3a64c6872be620edc3c 100644 (file)
@@ -75,6 +75,9 @@ class RGWPeriodHistory final {
     void prev() { epoch--; }
     void next() { epoch++; }
 
+    friend bool operator==(const Cursor& lhs, const Cursor& rhs);
+    friend bool operator!=(const Cursor& lhs, const Cursor& rhs);
+
    private:
     // private constructors for RGWPeriodHistory
     friend class RGWPeriodHistory::Impl;