hash_linklist_rep.h 1.9 KB

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