]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/table/adaptive/adaptive_table_factory.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / table / adaptive / adaptive_table_factory.h
1 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. See the AUTHORS file for names of contributors.
5
6 #pragma once
7
8 #ifndef ROCKSDB_LITE
9
10 #include <string>
11
12 #include "rocksdb/options.h"
13 #include "rocksdb/table.h"
14
15 namespace ROCKSDB_NAMESPACE {
16
17 struct EnvOptions;
18
19 class Status;
20 class RandomAccessFile;
21 class WritableFile;
22 class Table;
23 class TableBuilder;
24
25 class AdaptiveTableFactory : public TableFactory {
26 public:
27 ~AdaptiveTableFactory() {}
28
29 explicit AdaptiveTableFactory(
30 std::shared_ptr<TableFactory> table_factory_to_write,
31 std::shared_ptr<TableFactory> block_based_table_factory,
32 std::shared_ptr<TableFactory> plain_table_factory,
33 std::shared_ptr<TableFactory> cuckoo_table_factory);
34
35 const char* Name() const override { return "AdaptiveTableFactory"; }
36
37 using TableFactory::NewTableReader;
38 Status NewTableReader(
39 const ReadOptions& ro, const TableReaderOptions& table_reader_options,
40 std::unique_ptr<RandomAccessFileReader>&& file, uint64_t file_size,
41 std::unique_ptr<TableReader>* table,
42 bool prefetch_index_and_filter_in_cache = true) const override;
43
44 TableBuilder* NewTableBuilder(
45 const TableBuilderOptions& table_builder_options,
46 WritableFileWriter* file) const override;
47
48 std::string GetPrintableOptions() const override;
49
50 private:
51 std::shared_ptr<TableFactory> table_factory_to_write_;
52 std::shared_ptr<TableFactory> block_based_table_factory_;
53 std::shared_ptr<TableFactory> plain_table_factory_;
54 std::shared_ptr<TableFactory> cuckoo_table_factory_;
55 };
56
57 } // namespace ROCKSDB_NAMESPACE
58 #endif // ROCKSDB_LITE