Often there's a need to fetch value for a specified, single key. Publish
a new method in LevelDB that takes key and prefix and puts just value at
specified address, without the need for interim keysets or resultsets.
Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
return 0;
}
+int LevelDBStore::get(const string &prefix,
+ const string &key,
+ bufferlist *value)
+{
+ utime_t start = ceph_clock_now(g_ceph_context);
+ int r = 0;
+ KeyValueDB::Iterator it = get_iterator(prefix);
+ it->lower_bound(key);
+ if (it->valid() && it->key() == key) {
+ *value = it->value();
+ } else {
+ r = -ENOENT;
+ }
+ utime_t lat = ceph_clock_now(g_ceph_context) - start;
+ logger->inc(l_leveldb_gets);
+ logger->tinc(l_leveldb_get_latency, lat);
+ return r;
+}
+
string LevelDBStore::combine_strings(const string &prefix, const string &value)
{
string out = prefix;
std::map<string, bufferlist> *out
);
+ int get(const string &prefix,
+ const string &key,
+ bufferlist *value);
+
class LevelDBWholeSpaceIteratorImpl :
public KeyValueDB::WholeSpaceIteratorImpl {
protected: