]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: simplify full helpers, drop single-use helper
authorSage Weil <sage@inktank.com>
Tue, 18 Jun 2013 00:57:00 +0000 (17:57 -0700)
committerSage Weil <sage@inktank.com>
Tue, 25 Jun 2013 04:07:25 +0000 (21:07 -0700)
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 <sage@inktank.com>
src/mon/PaxosService.cc
src/mon/PaxosService.h

index fb704ca7a97d37d993118bda004f397b27114af1..68131affb1f99e4fba50d654c9c0f59e644a6f77 100644 (file)
@@ -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 << ")"
index 059a46b878b92f94964489092b30678232e4460b..566216a4d756d12e9d7621ddbb1f8e96ccd90424 100644 (file)
@@ -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);
   }
 
   /**