]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monc: new fsub_want_increment( function to make handling subscriptions easier
authorGreg Farnum <greg@inktank.com>
Tue, 11 Feb 2014 21:31:26 +0000 (13:31 -0800)
committerGreg Farnum <greg@inktank.com>
Sat, 15 Feb 2014 00:53:51 +0000 (16:53 -0800)
Provide a subscription-modifying function which will not decrement
the start version.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/mon/MonClient.h

index 1404f35786d3e23129885a57dab4c38660a31b92..9fcff2533e1a7ab8d2ab007960995d2fcd43b13f 100644 (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;