]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/kv: add support for fetching implementation specific properties
authorSamuel Just <sjust@redhat.com>
Fri, 26 Jul 2019 22:02:56 +0000 (15:02 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 27 Sep 2019 22:55:18 +0000 (15:55 -0700)
Only implemented for rocksdb for now.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/kv/KeyValueDB.h
src/kv/RocksDBStore.cc
src/kv/RocksDBStore.h

index 2ac43e7daac85c312b74cfec3126e09e55be3fad..0e4fed97cf4c81ca72d1cb5689eae967b6b8bc31 100644 (file)
@@ -424,6 +424,17 @@ public:
   virtual PerfCounters *get_perf_counters() {
     return nullptr;
   }
+
+  /**
+   * Access implementation specific integral property corresponding
+   * to passed property and prefic.
+   * Return value is true if property is valid for prefix, populates out.
+   */
+  virtual bool get_property(
+    const std::string &property,
+    uint64_t *out) {
+    return false;
+  }
 protected:
   /// List of matching prefixes/ColumnFamilies and merge operators
   std::vector<std::pair<std::string,
index 65affe40b97189134cb444b0e6afdc1ee64be25e..c2a9e917bd45aee2ac846b8c0fc06041e2fb3a85 100644 (file)
@@ -691,6 +691,13 @@ void RocksDBStore::split_stats(const std::string &s, char delim, std::vector<std
     }
 }
 
+bool RocksDBStore::get_property(
+  const std::string &property,
+  uint64_t *out)
+{
+  return db->GetIntProperty(property, out);
+}
+
 int64_t RocksDBStore::estimate_prefix_size(const string& prefix,
                                           const string& key_prefix)
 {
index e11d43b9ae10b84d729ecf3915063665acdee137..254f6f3afda505c56aeed8e5b930e79cac477408 100644 (file)
@@ -193,6 +193,10 @@ public:
     return logger;
   }
 
+  bool get_property(
+    const std::string &property,
+    uint64_t *out) final;
+
   int64_t estimate_prefix_size(const string& prefix,
                               const string& key_prefix) override;