From 5b9c187caf6f7847aaa4a1003d200158dd32bf63 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 11 Feb 2014 13:31:26 -0800 Subject: [PATCH] monc: new fsub_want_increment( function to make handling subscriptions easier Provide a subscription-modifying function which will not decrement the start version. Signed-off-by: Greg Farnum --- src/mon/MonClient.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 1404f35786d3e..9fcff2533e1a7 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -246,6 +246,22 @@ public: Mutex::Locker l(monc_lock); _sub_unwant(what); } + /** + * Increase the requested subscription start point. If you do increase + * the value, apply the passed-in flags as well; otherwise do nothing. + */ + bool sub_want_increment(string what, version_t start, unsigned flags) { + Mutex::Locker l(monc_lock); + map::iterator i = + sub_have.find(what); + if (i == sub_have.end() || i->second.start < start) { + ceph_mon_subscribe_item& item = sub_have[what]; + item.start = start; + item.flags = flags; + return true; + } + return false; + } KeyRing *keyring; RotatingKeyRing *rotating_secrets; -- 2.39.5