From: Casey Bodley Date: Tue, 23 Aug 2016 02:06:15 +0000 (-0400) Subject: rgw: add == and != operators for period history cursor X-Git-Tag: v12.0.3~225^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09c847ff790f55004871fb7304361ae6c9845b1a;p=ceph.git rgw: add == and != operators for period history cursor RGWMetaSyncCR was using operator== but it always returned true! Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_period_history.cc b/src/rgw/rgw_period_history.cc index eff0e78ad9de..895700f6897b 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 9541493aa142..0796c6116b5c 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;