]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/memtable/hash_cuckoo_rep.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / memtable / hash_cuckoo_rep.h
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 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style license that can be
7 // found in the LICENSE file. See the AUTHORS file for names of contributors.
8
9 #pragma once
10 #ifndef ROCKSDB_LITE
11 #include "port/port.h"
12 #include "rocksdb/slice_transform.h"
13 #include "rocksdb/memtablerep.h"
14
15 namespace rocksdb {
16
17 class HashCuckooRepFactory : public MemTableRepFactory {
18 public:
19 // maxinum number of hash functions used in the cuckoo hash.
20 static const unsigned int kMaxHashCount = 10;
21
22 explicit HashCuckooRepFactory(size_t write_buffer_size,
23 size_t average_data_size,
24 unsigned int hash_function_count)
25 : write_buffer_size_(write_buffer_size),
26 average_data_size_(average_data_size),
27 hash_function_count_(hash_function_count) {}
28
29 virtual ~HashCuckooRepFactory() {}
30
31 virtual MemTableRep* CreateMemTableRep(
32 const MemTableRep::KeyComparator& compare, MemTableAllocator* allocator,
33 const SliceTransform* transform, Logger* logger) override;
34
35 virtual const char* Name() const override { return "HashCuckooRepFactory"; }
36
37 private:
38 size_t write_buffer_size_;
39 size_t average_data_size_;
40 const unsigned int hash_function_count_;
41 };
42 } // namespace rocksdb
43 #endif // ROCKSDB_LITE