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 <greg@inktank.com>
This commit is contained in:
Greg Farnum 2014-02-11 13:31:26 -08:00
parent af5d0fcd90
commit 5b9c187caf

View File

@ -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<string,ceph_mon_subscribe_item>::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;