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.
12 #include "rocksdb/options.h"
13 #include "rocksdb/table.h"
15 namespace ROCKSDB_NAMESPACE
{
20 class RandomAccessFile
;
25 class AdaptiveTableFactory
: public TableFactory
{
27 ~AdaptiveTableFactory() {}
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
);
35 const char* Name() const override
{ return "AdaptiveTableFactory"; }
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
;
44 TableBuilder
* NewTableBuilder(
45 const TableBuilderOptions
& table_builder_options
,
46 WritableFileWriter
* file
) const override
;
48 std::string
GetPrintableOptions() const override
;
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_
;
57 } // namespace ROCKSDB_NAMESPACE
58 #endif // ROCKSDB_LITE