aboutsummaryrefslogtreecommitdiff
path: root/include/Key.hpp
diff options
context:
space:
mode:
authorAleksi Lindeman <0xdec05eba@gmail.com>2018-03-05 22:45:56 +0100
committerAleksi Lindeman <0xdec05eba@gmail.com>2018-03-05 22:48:26 +0100
commit2ffb47d0043e57707474e5ae811f97c2e5e93f25 (patch)
treefd60b300cdf736de5adc68b395105dcfc6a43f09 /include/Key.hpp
parent66661e47dc826f50b690e080057f47a0ea27016c (diff)
Implement 'create' operation, add seeding
Seeding is currently only done on the key you specify, in the future the user should request data that it can seed.
Diffstat (limited to 'include/Key.hpp')
-rw-r--r--include/Key.hpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/include/Key.hpp b/include/Key.hpp
index f7a600b..18971d1 100644
--- a/include/Key.hpp
+++ b/include/Key.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <opendht/infohash.h>
-#include <unordered_map>
namespace odhtdb
{
@@ -13,32 +12,4 @@ namespace odhtdb
dht::InfoHash hashedKey;
};
-
- // Source: https://stackoverflow.com/a/11414104 (public license)
- static unsigned int fnvHash(const unsigned char *key, int len)
- {
- unsigned int h = 2166136261;
- for (int i = 0; i < len; i++)
- h = (h * 16777619) ^ key[i];
- return h;
- }
-
- struct KeyHash
- {
- size_t operator()(const Key &key) const
- {
- return fnvHash(key.hashedKey.data(), key.hashedKey.size());
- }
- };
-
- struct KeyCompare
- {
- bool operator()(const Key &lhs, const Key &rhs) const
- {
- return lhs.hashedKey == rhs.hashedKey;
- }
- };
-
- template <typename ValueType>
- using KeyMap = std::unordered_map<Key, ValueType, KeyHash, KeyCompare>;
}