]> 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>
Tue, 25 Feb 2014 19:41:27 +0000 (11:41 -0800)
Provide a subscription-modifying function which will not decrement
the start version.

Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 5b9c187caf6f7847aaa4a1003d200158dd32bf63)

src/mon/MonClient.h

index dcd39775a8571d84a959a29c03d16a06d7c6324f..8ddfefec905f0765a9f647b1016aff347fbe7008 100644 (file)
@@ -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<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;