]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/table/adaptive_table_factory.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / table / adaptive_table_factory.h
CommitLineData
7c673cae
FG
1// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file. See the AUTHORS file for names of contributors.
4
5#pragma once
6
7#ifndef ROCKSDB_LITE
8
9#include <string>
10#include "rocksdb/options.h"
11#include "rocksdb/table.h"
12
13namespace rocksdb {
14
15struct EnvOptions;
16
7c673cae
FG
17class Status;
18class RandomAccessFile;
19class WritableFile;
20class Table;
21class TableBuilder;
22
23class AdaptiveTableFactory : public TableFactory {
24 public:
25 ~AdaptiveTableFactory() {}
26
27 explicit AdaptiveTableFactory(
28 std::shared_ptr<TableFactory> table_factory_to_write,
29 std::shared_ptr<TableFactory> block_based_table_factory,
30 std::shared_ptr<TableFactory> plain_table_factory,
31 std::shared_ptr<TableFactory> cuckoo_table_factory);
32
33 const char* Name() const override { return "AdaptiveTableFactory"; }
34
35 Status NewTableReader(
36 const TableReaderOptions& table_reader_options,
494da23a
TL
37 std::unique_ptr<RandomAccessFileReader>&& file, uint64_t file_size,
38 std::unique_ptr<TableReader>* table,
7c673cae
FG
39 bool prefetch_index_and_filter_in_cache = true) const override;
40
41 TableBuilder* NewTableBuilder(
42 const TableBuilderOptions& table_builder_options,
43 uint32_t column_family_id, WritableFileWriter* file) const override;
44
45 // Sanitizes the specified DB Options.
11fdf7f2
TL
46 Status SanitizeOptions(
47 const DBOptions& /*db_opts*/,
48 const ColumnFamilyOptions& /*cf_opts*/) const override {
7c673cae
FG
49 return Status::OK();
50 }
51
52 std::string GetPrintableTableOptions() const override;
53
54 private:
55 std::shared_ptr<TableFactory> table_factory_to_write_;
56 std::shared_ptr<TableFactory> block_based_table_factory_;
57 std::shared_ptr<TableFactory> plain_table_factory_;
58 std::shared_ptr<TableFactory> cuckoo_table_factory_;
59};
60
61} // namespace rocksdb
62#endif // ROCKSDB_LITE