Expose rocksdb_options_copy function to the C API (#6880)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/6880 Reviewed By: ajkr Differential Revision: D21842752 Pulled By: pdillinger fbshipit-source-id: eda326f551ddd9cb397681544b9e9799ea614e52
This commit is contained in:
parent
14eca6bf04
commit
38f988d3b4
4
db/c.cc
4
db/c.cc
|
@ -2154,6 +2154,10 @@ void rocksdb_options_destroy(rocksdb_options_t* options) {
|
|||
delete options;
|
||||
}
|
||||
|
||||
rocksdb_options_t* rocksdb_options_create_copy(rocksdb_options_t* options) {
|
||||
return new rocksdb_options_t(*options);
|
||||
}
|
||||
|
||||
void rocksdb_options_increase_parallelism(
|
||||
rocksdb_options_t* opt, int total_threads) {
|
||||
opt->rep.IncreaseParallelism(total_threads);
|
||||
|
|
17
db/c_test.c
17
db/c_test.c
|
@ -1461,6 +1461,23 @@ int main(int argc, char** argv) {
|
|||
rocksdb_cuckoo_options_destroy(cuckoo_options);
|
||||
}
|
||||
|
||||
StartPhase("options");
|
||||
{
|
||||
rocksdb_options_t* o;
|
||||
o = rocksdb_options_create();
|
||||
rocksdb_options_set_create_if_missing(o, 1);
|
||||
|
||||
rocksdb_options_t* copy;
|
||||
copy = rocksdb_options_create_copy(o);
|
||||
// TODO: some way to check that *copy == *o
|
||||
|
||||
rocksdb_options_set_create_if_missing(copy, 0);
|
||||
// TODO: some way to check that *copy != *o
|
||||
|
||||
rocksdb_options_destroy(copy);
|
||||
rocksdb_options_destroy(o);
|
||||
}
|
||||
|
||||
StartPhase("iterate_upper_bound");
|
||||
{
|
||||
// Create new empty database
|
||||
|
|
|
@ -771,6 +771,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_set_options_cf(
|
|||
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create();
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_options_destroy(rocksdb_options_t*);
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create_copy(
|
||||
rocksdb_options_t*);
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_options_increase_parallelism(
|
||||
rocksdb_options_t* opt, int total_threads);
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_for_point_lookup(
|
||||
|
|
Loading…
Reference in New Issue
Block a user