]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae FG |
5 | #pragma once |
6 | ||
7 | #include <vector> | |
8 | #include <string> | |
9 | #include "util/dynamic_bloom.h" | |
10 | ||
11 | namespace rocksdb { | |
12 | class Logger; | |
13 | ||
14 | class BloomBlockBuilder { | |
15 | public: | |
16 | static const std::string kBloomBlock; | |
17 | ||
18 | explicit BloomBlockBuilder(uint32_t num_probes = 6) | |
19 | : bloom_(num_probes, nullptr) {} | |
20 | ||
21 | void SetTotalBits(Allocator* allocator, uint32_t total_bits, | |
22 | uint32_t locality, size_t huge_page_tlb_size, | |
23 | Logger* logger) { | |
24 | bloom_.SetTotalBits(allocator, total_bits, locality, huge_page_tlb_size, | |
25 | logger); | |
26 | } | |
27 | ||
28 | uint32_t GetNumBlocks() const { return bloom_.GetNumBlocks(); } | |
29 | ||
30 | void AddKeysHashes(const std::vector<uint32_t>& keys_hashes); | |
31 | ||
32 | Slice Finish(); | |
33 | ||
34 | private: | |
35 | DynamicBloom bloom_; | |
36 | }; | |
37 | ||
38 | }; // namespace rocksdb |