From: Greg Farnum Date: Tue, 11 Feb 2014 21:31:26 +0000 (-0800) Subject: monc: new fsub_want_increment( function to make handling subscriptions easier X-Git-Tag: v0.67.8~33^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d93d67d1a315d8abe8d1cd9d7ea83417a19e2406;p=ceph.git 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 Reviewed-by: Sage Weil (cherry picked from commit 5b9c187caf6f7847aaa4a1003d200158dd32bf63) --- diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index dcd39775a857..8ddfefec905f 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -193,6 +193,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;