]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/memtable/hash_cuckoo_rep.h
build: use dgit for download target
[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 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 // 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 using MemTableRepFactory::CreateMemTableRep;
32 virtual MemTableRep* CreateMemTableRep(
33 const MemTableRep::KeyComparator& compare, Allocator* allocator,
34 const SliceTransform* transform, Logger* logger) override;
35
36 virtual const char* Name() const override { return "HashCuckooRepFactory"; }
37
38 private:
39 size_t write_buffer_size_;
40 size_t average_data_size_;
41 const unsigned int hash_function_count_;
42 };
43 } // namespace rocksdb
44 #endif // ROCKSDB_LITE