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 "rocksdb/slice_transform.h"
12 #include "rocksdb/memtablerep.h"
13 
14 namespace ROCKSDB_NAMESPACE {
15 
16 class HashLinkListRepFactory : public MemTableRepFactory {
17  public:
HashLinkListRepFactory(size_t bucket_count,uint32_t threshold_use_skiplist,size_t huge_page_tlb_size,int bucket_entries_logging_threshold,bool if_log_bucket_dist_when_flash)18   explicit HashLinkListRepFactory(size_t bucket_count,
19                                   uint32_t threshold_use_skiplist,
20                                   size_t huge_page_tlb_size,
21                                   int bucket_entries_logging_threshold,
22                                   bool if_log_bucket_dist_when_flash)
23       : bucket_count_(bucket_count),
24         threshold_use_skiplist_(threshold_use_skiplist),
25         huge_page_tlb_size_(huge_page_tlb_size),
26         bucket_entries_logging_threshold_(bucket_entries_logging_threshold),
27         if_log_bucket_dist_when_flash_(if_log_bucket_dist_when_flash) {}
28 
~HashLinkListRepFactory()29   virtual ~HashLinkListRepFactory() {}
30 
31   using MemTableRepFactory::CreateMemTableRep;
32   virtual MemTableRep* CreateMemTableRep(
33       const MemTableRep::KeyComparator& compare, Allocator* allocator,
34       const SliceTransform* transform, Logger* logger) override;
35 
Name()36   virtual const char* Name() const override {
37     return "HashLinkListRepFactory";
38   }
39 
40  private:
41   const size_t bucket_count_;
42   const uint32_t threshold_use_skiplist_;
43   const size_t huge_page_tlb_size_;
44   int bucket_entries_logging_threshold_;
45   bool if_log_bucket_dist_when_flash_;
46 };
47 
48 }  // namespace ROCKSDB_NAMESPACE
49 #endif  // ROCKSDB_LITE
50