]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/util/hash_containers.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / util / hash_containers.h
1 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 // This header establishes compile-time pluggable implementations of hashed
7 // container structures, so that deployments have the option of minimal
8 // dependencies with ok performance (e.g. std::unordered_map) or more
9 // dependencies with optimized performance (e.g. folly::F14FastMap).
10
11 #pragma once
12
13 #include "rocksdb/rocksdb_namespace.h"
14
15 #ifdef USE_FOLLY
16
17 #include <folly/container/F14Map.h>
18 #include <folly/container/F14Set.h>
19
20 namespace ROCKSDB_NAMESPACE {
21
22 template <typename K, typename V>
23 using UnorderedMap = folly::F14FastMap<K, V>;
24
25 template <typename K, typename V, typename H>
26 using UnorderedMapH = folly::F14FastMap<K, V, H>;
27
28 template <typename K>
29 using UnorderedSet = folly::F14FastSet<K>;
30
31 } // namespace ROCKSDB_NAMESPACE
32
33 #else
34
35 #include <unordered_map>
36 #include <unordered_set>
37
38 namespace ROCKSDB_NAMESPACE {
39
40 template <typename K, typename V>
41 using UnorderedMap = std::unordered_map<K, V>;
42
43 template <typename K, typename V, typename H>
44 using UnorderedMapH = std::unordered_map<K, V, H>;
45
46 template <typename K>
47 using UnorderedSet = std::unordered_set<K>;
48
49 } // namespace ROCKSDB_NAMESPACE
50
51 #endif