/Users/deen/code/yugabyte-db/src/yb/rocksdb/table/bloom_block.h
Line | Count | Source |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under the BSD-style license found in the |
3 | | // LICENSE file in the root directory of this source tree. An additional grant |
4 | | // of patent rights can be found in the PATENTS file in the same directory. |
5 | | // |
6 | | // The following only applies to changes made to this file as part of YugaByte development. |
7 | | // |
8 | | // Portions Copyright (c) YugaByte, Inc. |
9 | | // |
10 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
11 | | // in compliance with the License. You may obtain a copy of the License at |
12 | | // |
13 | | // http://www.apache.org/licenses/LICENSE-2.0 |
14 | | // |
15 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
16 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
17 | | // or implied. See the License for the specific language governing permissions and limitations |
18 | | // under the License. |
19 | | // |
20 | | #pragma once |
21 | | |
22 | | #include <vector> |
23 | | #include <string> |
24 | | #include "yb/rocksdb/util/dynamic_bloom.h" |
25 | | |
26 | | namespace rocksdb { |
27 | | class Logger; |
28 | | |
29 | | class BloomBlockBuilder { |
30 | | public: |
31 | | static const std::string kBloomBlock; |
32 | | |
33 | | explicit BloomBlockBuilder(uint32_t num_probes = 6) |
34 | 2.05k | : bloom_(num_probes, nullptr) {} |
35 | | |
36 | | void SetTotalBits(Allocator* allocator, uint32_t total_bits, |
37 | | uint32_t locality, size_t huge_page_tlb_size, |
38 | 64 | Logger* logger) { |
39 | 64 | bloom_.SetTotalBits(allocator, total_bits, locality, huge_page_tlb_size, |
40 | 64 | logger); |
41 | 64 | } |
42 | | |
43 | 64 | uint32_t GetNumBlocks() const { return bloom_.GetNumBlocks(); } |
44 | | |
45 | | void AddKeysHashes(const std::vector<uint32_t>& keys_hashes); |
46 | | |
47 | | Slice Finish(); |
48 | | |
49 | | private: |
50 | | DynamicBloom bloom_; |
51 | | }; |
52 | | |
53 | | }; // namespace rocksdb |