From: Sage Weil Date: Tue, 18 Jun 2013 00:57:00 +0000 (-0700) Subject: mon/PaxosService: simplify full helpers, drop single-use helper X-Git-Tag: v0.67-rc1~175^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=872f4d5fb41c46f69b01823bf07bae68b7b4f283;p=ceph.git mon/PaxosService: simplify full helpers, drop single-use helper We are the only caller for get_version(prefix, name), so move it inline and drop it. Also rename full_version_name to full_prefix_name, which I find slightly less confusing. Signed-off-by: Sage Weil --- diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index fb704ca7a97d..68131affb1f9 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -362,7 +362,7 @@ void PaxosService::trim(MonitorDBStore::Transaction *t, void PaxosService::encode_trim(MonitorDBStore::Transaction *t) { version_t first_committed = get_first_committed(); - version_t latest_full = get_version("full", "latest"); + version_t latest_full = get_version_latest_full(); version_t trim_to = get_trim_to(); dout(10) << __func__ << " " << trim_to << " (was " << first_committed << ")" diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 059a46b878b9..566216a4d756 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -196,7 +196,7 @@ public: last_committed_name("last_committed"), first_committed_name("first_committed"), last_accepted_name("last_accepted"), - full_version_name("full"), full_latest_name("latest"), + full_prefix_name("full"), full_latest_name("latest"), cached_first_committed(0), cached_last_committed(0) { } @@ -466,7 +466,7 @@ public: const string last_committed_name; const string first_committed_name; const string last_accepted_name; - const string full_version_name; + const string full_prefix_name; const string full_latest_name; /** * @} @@ -821,7 +821,7 @@ public: */ void put_version_full(MonitorDBStore::Transaction *t, version_t ver, bufferlist& bl) { - string key = mon->store->combine_strings(full_version_name, ver); + string key = mon->store->combine_strings(full_prefix_name, ver); t->put(get_service_name(), key, bl); } /** @@ -833,7 +833,7 @@ public: */ void put_version_latest_full(MonitorDBStore::Transaction *t, version_t ver) { string key = - mon->store->combine_strings(full_version_name, full_latest_name); + mon->store->combine_strings(full_prefix_name, full_latest_name); t->put(get_service_name(), key, ver); } /** @@ -925,18 +925,6 @@ public: * @return 0 on success; <0 otherwise */ int get_version(const string& prefix, version_t ver, bufferlist& bl); - /** - * Get a version number from a given key, whose name is composed by - * @p prefix and @p name combined. - * - * @param prefix Key's prefix - * @param name Key's suffix - * @returns A version number - */ - version_t get_version(const string& prefix, const string& name) { - string key = mon->store->combine_strings(prefix, name); - return mon->store->get(get_service_name(), key); - } /** * Get the contents of a given full version of this service. * @@ -945,7 +933,7 @@ public: * @returns 0 on success; <0 otherwise */ int get_version_full(version_t ver, bufferlist& bl) { - string key = mon->store->combine_strings(full_version_name, ver); + string key = mon->store->combine_strings(full_prefix_name, ver); return mon->store->get(get_service_name(), key, bl); } /** @@ -954,7 +942,8 @@ public: * @returns A version number */ version_t get_version_latest_full() { - return get_version(full_version_name, full_latest_name); + string key = mon->store->combine_strings(full_prefix_name, full_latest_name); + return mon->store->get(get_service_name(), key); } /**