aboutsummaryrefslogtreecommitdiffhomepage
path: root/tddb
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2023-10-16 10:11:09 +0300
committerlevlam <levlam@telegram.org>2023-10-16 10:11:09 +0300
commit81d14838c4294a733ff4f451a4ad9de106b393b4 (patch)
tree2ee0d5e9d0268717a5e147ea34669aff8775d159 /tddb
parentfab24473cac670e83279f97081c53ae617596a0b (diff)
Return unordered_map from prefix_get.
Diffstat (limited to 'tddb')
-rw-r--r--tddb/td/db/BinlogKeyValue.h5
-rw-r--r--tddb/td/db/KeyValueSyncInterface.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/tddb/td/db/BinlogKeyValue.h b/tddb/td/db/BinlogKeyValue.h
index 9aaf6e266..fa9cc405a 100644
--- a/tddb/td/db/BinlogKeyValue.h
+++ b/tddb/td/db/BinlogKeyValue.h
@@ -26,6 +26,7 @@
#include "td/utils/tl_storers.h"
#include <memory>
+#include <unordered_map>
#include <utility>
namespace td {
@@ -218,9 +219,9 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
binlog_->lazy_sync(std::move(promise));
}
- FlatHashMap<string, string> prefix_get(Slice prefix) final {
+ std::unordered_map<string, string> prefix_get(Slice prefix) final {
auto lock = rw_mutex_.lock_write().move_as_ok();
- FlatHashMap<string, string> res;
+ std::unordered_map<string, 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 09515974f..0fb50ced8 100644
--- a/tddb/td/db/KeyValueSyncInterface.h
+++ b/tddb/td/db/KeyValueSyncInterface.h
@@ -11,6 +11,8 @@
#include "td/utils/Promise.h"
#include "td/utils/Slice.h"
+#include <unordered_map>
+
namespace td {
class KeyValueSyncInterface {
@@ -32,7 +34,7 @@ class KeyValueSyncInterface {
virtual string get(const string &key) = 0;
- virtual FlatHashMap<string, string> prefix_get(Slice prefix) = 0;
+ virtual std::unordered_map<string, string> prefix_get(Slice prefix) = 0;
virtual FlatHashMap<string, string> get_all() = 0;