summaryrefslogtreecommitdiffstats
path: root/src/kv
diff options
context:
space:
mode:
authorSamuel Just <sjust@redhat.com>2019-07-27 00:02:56 +0200
committerSamuel Just <sjust@redhat.com>2019-09-28 00:55:18 +0200
commitc261ea9a45ed0ff07ae15364ab7904bc810320e9 (patch)
tree8e911bb7e03ccee0afa96f3f019857bddd3690cd /src/kv
parentcommon/Throttle: maintain count even if disabled (diff)
downloadceph-c261ea9a45ed0ff07ae15364ab7904bc810320e9.tar.xz
ceph-c261ea9a45ed0ff07ae15364ab7904bc810320e9.zip
src/kv: add support for fetching implementation specific properties
Only implemented for rocksdb for now. Signed-off-by: Samuel Just <sjust@redhat.com>
Diffstat (limited to 'src/kv')
-rw-r--r--src/kv/KeyValueDB.h11
-rw-r--r--src/kv/RocksDBStore.cc7
-rw-r--r--src/kv/RocksDBStore.h4
3 files changed, 22 insertions, 0 deletions
diff --git a/src/kv/KeyValueDB.h b/src/kv/KeyValueDB.h
index 2ac43e7daac..0e4fed97cf4 100644
--- a/src/kv/KeyValueDB.h
+++ b/src/kv/KeyValueDB.h
@@ -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,
diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index 65affe40b97..c2a9e917bd4 100644
--- a/src/kv/RocksDBStore.cc
+++ b/src/kv/RocksDBStore.cc
@@ -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)
{
diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h
index e11d43b9ae1..254f6f3afda 100644
--- a/src/kv/RocksDBStore.h
+++ b/src/kv/RocksDBStore.h
@@ -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;