From 12600417772f21ddf83e573a5cf9fab201a98215 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 4 Apr 2013 18:17:21 +0100 Subject: [PATCH] mon: PaxosService: add helper function to check if a given version exists Signed-off-by: Joao Eduardo Luis --- src/mon/PaxosService.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index cc403574df8..f16bc77cdeb 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -17,6 +17,7 @@ #include "messages/PaxosServiceMessage.h" #include "include/Context.h" +#include "include/stringify.h" #include #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)); + } /** * @} */ -- 2.47.3