From 09c847ff790f55004871fb7304361ae6c9845b1a Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 22 Aug 2016 22:06:15 -0400 Subject: [PATCH] rgw: add == and != operators for period history cursor RGWMetaSyncCR was using operator== but it always returned true! Signed-off-by: Casey Bodley --- src/rgw/rgw_period_history.cc | 9 +++++++++ src/rgw/rgw_period_history.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/rgw/rgw_period_history.cc b/src/rgw/rgw_period_history.cc index eff0e78ad9dee..895700f6897bc 100644 --- a/src/rgw/rgw_period_history.cc +++ b/src/rgw/rgw_period_history.cc @@ -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: diff --git a/src/rgw/rgw_period_history.h b/src/rgw/rgw_period_history.h index 9541493aa1427..0796c6116b5ce 100644 --- a/src/rgw/rgw_period_history.h +++ b/src/rgw/rgw_period_history.h @@ -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; -- 2.39.5