]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
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 | #include "options/customizable_helper.h" | |
7 | #include "rocksdb/convenience.h" | |
8 | #include "rocksdb/table.h" | |
9 | #include "table/block_based/block_based_table_factory.h" | |
10 | #include "table/cuckoo/cuckoo_table_factory.h" | |
11 | #include "table/plain/plain_table_factory.h" | |
12 | ||
13 | namespace ROCKSDB_NAMESPACE { | |
14 | ||
15 | static bool LoadFactory(const std::string& name, | |
16 | std::shared_ptr<TableFactory>* factory) { | |
17 | bool success = true; | |
18 | if (name == TableFactory::kBlockBasedTableName()) { | |
19 | factory->reset(new BlockBasedTableFactory()); | |
20 | #ifndef ROCKSDB_LITE | |
21 | } else if (name == TableFactory::kPlainTableName()) { | |
22 | factory->reset(new PlainTableFactory()); | |
23 | } else if (name == TableFactory::kCuckooTableName()) { | |
24 | factory->reset(new CuckooTableFactory()); | |
25 | #endif // ROCKSDB_LITE | |
26 | } else { | |
27 | success = false; | |
28 | } | |
29 | return success; | |
30 | } | |
31 | ||
32 | Status TableFactory::CreateFromString(const ConfigOptions& config_options, | |
33 | const std::string& value, | |
34 | std::shared_ptr<TableFactory>* factory) { | |
35 | return LoadSharedObject<TableFactory>(config_options, value, LoadFactory, | |
36 | factory); | |
37 | } | |
38 | } // namespace ROCKSDB_NAMESPACE |