aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/hash_table.cpp
diff options
context:
space:
mode:
authortobo <tobo@yandex-team.com>2022-09-09 11:15:36 +0300
committertobo <tobo@yandex-team.com>2022-09-09 11:15:36 +0300
commite96ef596aca8afaf0326b57001ff56fbdd643e8a (patch)
tree25ae6137d298b7f53fd06e1c25066b7409f4ea8e /util/generic/hash_table.cpp
parent5491c0676017f1d89131e40a7b910e9a28c8fde2 (diff)
downloadydb-e96ef596aca8afaf0326b57001ff56fbdd643e8a.tar.gz
prepare to split hash.h into hash_table.h hash.h and multi_hash_map.h
Diffstat (limited to 'util/generic/hash_table.cpp')
-rw-r--r--util/generic/hash_table.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/util/generic/hash_table.cpp b/util/generic/hash_table.cpp
new file mode 100644
index 0000000000..a6b119e821
--- /dev/null
+++ b/util/generic/hash_table.cpp
@@ -0,0 +1,51 @@
+#include "hash_table.h"
+
+#include <util/string/escape.h>
+#include <util/string/cast.h>
+
+const void* const _yhashtable_empty_data[] = {(void*)3, nullptr, (void*)1};
+
+TString NPrivate::MapKeyToString(TStringBuf key) {
+ constexpr size_t HASH_KEY_MAX_LENGTH = 500;
+ try {
+ return EscapeC(key.substr(0, HASH_KEY_MAX_LENGTH));
+ } catch (...) {
+ return "TStringBuf";
+ }
+}
+
+TString NPrivate::MapKeyToString(unsigned short key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(short key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(unsigned int key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(int key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(unsigned long key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(long key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(unsigned long long key) {
+ return ToString(key);
+}
+
+TString NPrivate::MapKeyToString(long long key) {
+ return ToString(key);
+}
+
+void NPrivate::ThrowKeyNotFoundInHashTableException(const TStringBuf keyRepresentation) {
+ ythrow yexception() << "Key not found in hashtable: " << keyRepresentation;
+}