/Users/deen/code/yugabyte-db/src/yb/rocksdb/table/adaptive_table_factory.h
Line | Count | Source |
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 | | // The following only applies to changes made to this file as part of YugaByte development. |
6 | | // |
7 | | // Portions Copyright (c) YugaByte, Inc. |
8 | | // |
9 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
10 | | // in compliance with the License. You may obtain a copy of the License at |
11 | | // |
12 | | // http://www.apache.org/licenses/LICENSE-2.0 |
13 | | // |
14 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
15 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
16 | | // or implied. See the License for the specific language governing permissions and limitations |
17 | | // under the License. |
18 | | // |
19 | | |
20 | | #ifndef YB_ROCKSDB_TABLE_ADAPTIVE_TABLE_FACTORY_H |
21 | | #define YB_ROCKSDB_TABLE_ADAPTIVE_TABLE_FACTORY_H |
22 | | |
23 | | #ifndef ROCKSDB_LITE |
24 | | |
25 | | #include <string> |
26 | | #include "yb/rocksdb/options.h" |
27 | | #include "yb/rocksdb/status.h" |
28 | | #include "yb/rocksdb/table.h" |
29 | | |
30 | | namespace rocksdb { |
31 | | |
32 | | struct EnvOptions; |
33 | | |
34 | | using std::unique_ptr; |
35 | | class WritableFile; |
36 | | class Table; |
37 | | class TableBuilder; |
38 | | |
39 | | class AdaptiveTableFactory : public TableFactory { |
40 | | public: |
41 | 2 | ~AdaptiveTableFactory() {} |
42 | | |
43 | | explicit AdaptiveTableFactory( |
44 | | std::shared_ptr<TableFactory> table_factory_to_write, |
45 | | std::shared_ptr<TableFactory> block_based_table_factory, |
46 | | std::shared_ptr<TableFactory> plain_table_factory); |
47 | | |
48 | 16 | const char* Name() const override { return "AdaptiveTableFactory"; } |
49 | | |
50 | | Status NewTableReader(const TableReaderOptions& table_reader_options, |
51 | | unique_ptr<RandomAccessFileReader>&& file, |
52 | | uint64_t file_size, |
53 | | unique_ptr<TableReader>* table) const override; |
54 | | |
55 | | TableBuilder *NewTableBuilder(const TableBuilderOptions &table_builder_options, |
56 | | uint32_t column_family_id, |
57 | | WritableFileWriter *base_file, |
58 | | WritableFileWriter *data_file = nullptr) const override; |
59 | | |
60 | | bool IsSplitSstForWriteSupported() const override; |
61 | | |
62 | | // Sanitizes the specified DB Options. |
63 | | Status SanitizeOptions(const DBOptions& db_opts, |
64 | 4 | const ColumnFamilyOptions& cf_opts) const override { |
65 | 4 | return Status::OK(); |
66 | 4 | } |
67 | | |
68 | | std::string GetPrintableTableOptions() const override; |
69 | | |
70 | | private: |
71 | | std::shared_ptr<TableFactory> table_factory_to_write_; |
72 | | std::shared_ptr<TableFactory> block_based_table_factory_; |
73 | | std::shared_ptr<TableFactory> plain_table_factory_; |
74 | | }; |
75 | | |
76 | | } // namespace rocksdb |
77 | | #endif // ROCKSDB_LITE |
78 | | |
79 | | #endif // YB_ROCKSDB_TABLE_ADAPTIVE_TABLE_FACTORY_H |