aboutsummaryrefslogtreecommitdiffhomepage
path: root/tddb
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2023-10-28 00:06:56 +0300
committerlevlam <levlam@telegram.org>2023-10-28 00:06:56 +0300
commit9c9c1bb51c6342970ba2f33d55bfc2b816f1ff4f (patch)
tree4ab7fc8325b595ddcd156d15156c430bdabc6eaa /tddb
parent7097b2bf5b17d7029e1f39c59bb4bfd5e3f0ad92 (diff)
Minor improvements.
Diffstat (limited to 'tddb')
-rw-r--r--tddb/td/db/BinlogKeyValue.h5
-rw-r--r--tddb/td/db/KeyValueSyncInterface.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/tddb/td/db/BinlogKeyValue.h b/tddb/td/db/BinlogKeyValue.h
index fa9cc405a..0665aefa8 100644
--- a/tddb/td/db/BinlogKeyValue.h
+++ b/tddb/td/db/BinlogKeyValue.h
@@ -15,6 +15,7 @@
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
+#include "td/utils/HashTableUtils.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/RwMutex.h"
@@ -219,9 +220,9 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
binlog_->lazy_sync(std::move(promise));
}
- std::unordered_map<string, string> prefix_get(Slice prefix) final {
+ std::unordered_map<string, string, Hash<string>> prefix_get(Slice prefix) final {
auto lock = rw_mutex_.lock_write().move_as_ok();
- std::unordered_map<string, string> res;
+ std::unordered_map<string, string, Hash<string>> res;
for (const auto &kv : map_) {
if (begins_with(kv.first, prefix)) {
res.emplace(kv.first.substr(prefix.size()), kv.second.first);
diff --git a/tddb/td/db/KeyValueSyncInterface.h b/tddb/td/db/KeyValueSyncInterface.h
index 0fb50ced8..ed29c6b96 100644
--- a/tddb/td/db/KeyValueSyncInterface.h
+++ b/tddb/td/db/KeyValueSyncInterface.h
@@ -8,6 +8,7 @@
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
+#include "td/utils/HashTableUtils.h"
#include "td/utils/Promise.h"
#include "td/utils/Slice.h"
@@ -34,7 +35,7 @@ class KeyValueSyncInterface {
virtual string get(const string &key) = 0;
- virtual std::unordered_map<string, string> prefix_get(Slice prefix) = 0;
+ virtual std::unordered_map<string, string, Hash<string>> prefix_get(Slice prefix) = 0;
virtual FlatHashMap<string, string> get_all() = 0;