]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PaxosService: add helper function to check if a given version exists
authorJoao Eduardo Luis <joao.luis@inktank.com>
Thu, 4 Apr 2013 17:17:21 +0000 (18:17 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 17 Apr 2013 21:17:47 +0000 (22:17 +0100)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PaxosService.h

index cc403574df8684639d054cb6ca3c92c91483cd4d..f16bc77cdeb1b28d14a16e8279ad6931adb9a6e9 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "messages/PaxosServiceMessage.h"
 #include "include/Context.h"
+#include "include/stringify.h"
 #include <errno.h>
 #include "Paxos.h"
 #include "Monitor.h"
@@ -918,6 +919,17 @@ public:
     string key = mon->store->combine_strings(prefix, name);
     return mon->store->exists(get_service_name(), key);
   }
+
+  /**
+   * Checks if a given version @v exists
+   *
+   * @param prefix key's prefix
+   * @param v key's suffix
+   * @returns true if key exists; false otherwise.
+   */
+  bool exists_version(const string& prefix, const version_t v) {
+    return exists_key(prefix, stringify(v));
+  }
   /**
    * @}
    */