]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/utilities/options_util.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / include / rocksdb / utilities / options_util.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5
6 // This file contains utility functions for RocksDB Options.
7 #pragma once
8
9 #ifndef ROCKSDB_LITE
10
11 #include <string>
12 #include <vector>
13
14 #include "rocksdb/db.h"
15 #include "rocksdb/env.h"
16 #include "rocksdb/options.h"
17 #include "rocksdb/status.h"
18
19 namespace rocksdb {
20 // Constructs the DBOptions and ColumnFamilyDescriptors by loading the
21 // latest RocksDB options file stored in the specified rocksdb database.
22 //
23 // Note that the all the pointer options (except table_factory, which will
24 // be described in more details below) will be initialized with the default
25 // values. Developers can further initialize them after this function call.
26 // Below is an example list of pointer options which will be initialized
27 //
28 // * env
29 // * memtable_factory
30 // * compaction_filter_factory
31 // * prefix_extractor
32 // * comparator
33 // * merge_operator
34 // * compaction_filter
35 //
36 // For table_factory, this function further supports deserializing
37 // BlockBasedTableFactory and its BlockBasedTableOptions except the
38 // pointer options of BlockBasedTableOptions (flush_block_policy_factory,
39 // block_cache, and block_cache_compressed), which will be initialized with
40 // default values. Developers can further specify these three options by
41 // casting the return value of TableFactoroy::GetOptions() to
42 // BlockBasedTableOptions and making necessary changes.
43 //
44 // examples/options_file_example.cc demonstrates how to use this function
45 // to open a RocksDB instance.
46 //
47 // @return the function returns an OK status when it went successfully. If
48 // the specified "dbpath" does not contain any option file, then a
49 // Status::NotFound will be returned. A return value other than
50 // Status::OK or Status::NotFound indicates there're some error related
51 // to the options file itself.
52 //
53 // @see LoadOptionsFromFile
54 Status LoadLatestOptions(const std::string& dbpath, Env* env,
55 DBOptions* db_options,
56 std::vector<ColumnFamilyDescriptor>* cf_descs);
57
58 // Similar to LoadLatestOptions, this function constructs the DBOptions
59 // and ColumnFamilyDescriptors based on the specified RocksDB Options file.
60 //
61 // @see LoadLatestOptions
62 Status LoadOptionsFromFile(const std::string& options_file_name, Env* env,
63 DBOptions* db_options,
64 std::vector<ColumnFamilyDescriptor>* cf_descs);
65
66 // Returns the latest options file name under the specified db path.
67 Status GetLatestOptionsFileName(const std::string& dbpath, Env* env,
68 std::string* options_file_name);
69
70 // Returns Status::OK if the input DBOptions and ColumnFamilyDescriptors
71 // are compatible with the latest options stored in the specified DB path.
72 //
73 // If the return status is non-ok, it means the specified RocksDB instance
74 // might not be correctly opened with the input set of options. Currently,
75 // changing one of the following options will fail the compatibility check:
76 //
77 // * comparator
78 // * prefix_extractor
79 // * table_factory
80 // * merge_operator
81 Status CheckOptionsCompatibility(
82 const std::string& dbpath, Env* env, const DBOptions& db_options,
83 const std::vector<ColumnFamilyDescriptor>& cf_descs);
84
85 } // namespace rocksdb
86 #endif // !ROCKSDB_LITE