Summary: Moved convenience.h out of utilities to remove a dependency on utilities in db. Test Plan: unit tests. Also compiled a link to the old location to verify the _Pragma works. Reviewers: sdong, yhchiang, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D42201main
parent
beb19ad0dd
commit
81d072623c
@ -0,0 +1,63 @@ |
||||
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
|
||||
// This source code is licensed under the BSD-style license found in the
|
||||
// LICENSE file in the root directory of this source tree. An additional grant
|
||||
// of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
#pragma once |
||||
|
||||
#include <unordered_map> |
||||
#include <string> |
||||
#include "rocksdb/options.h" |
||||
#include "rocksdb/table.h" |
||||
|
||||
namespace rocksdb { |
||||
|
||||
#ifndef ROCKSDB_LITE |
||||
// Take a map of option name and option value, apply them into the
|
||||
// base_options, and return the new options as a result
|
||||
Status GetColumnFamilyOptionsFromMap( |
||||
const ColumnFamilyOptions& base_options, |
||||
const std::unordered_map<std::string, std::string>& opts_map, |
||||
ColumnFamilyOptions* new_options); |
||||
|
||||
Status GetDBOptionsFromMap( |
||||
const DBOptions& base_options, |
||||
const std::unordered_map<std::string, std::string>& opts_map, |
||||
DBOptions* new_options); |
||||
|
||||
Status GetBlockBasedTableOptionsFromMap( |
||||
const BlockBasedTableOptions& table_options, |
||||
const std::unordered_map<std::string, std::string>& opts_map, |
||||
BlockBasedTableOptions* new_table_options); |
||||
|
||||
// Take a string representation of option names and values, apply them into the
|
||||
// base_options, and return the new options as a result. The string has the
|
||||
// following format:
|
||||
// "write_buffer_size=1024;max_write_buffer_number=2"
|
||||
// Nested options config is also possible. For example, you can define
|
||||
// BlockBasedTableOptions as part of the string for block-based table factory:
|
||||
// "write_buffer_size=1024;block_based_table_factory={block_size=4k};"
|
||||
// "max_write_buffer_num=2"
|
||||
Status GetColumnFamilyOptionsFromString( |
||||
const ColumnFamilyOptions& base_options, |
||||
const std::string& opts_str, |
||||
ColumnFamilyOptions* new_options); |
||||
|
||||
Status GetDBOptionsFromString( |
||||
const DBOptions& base_options, |
||||
const std::string& opts_str, |
||||
DBOptions* new_options); |
||||
|
||||
Status GetBlockBasedTableOptionsFromString( |
||||
const BlockBasedTableOptions& table_options, |
||||
const std::string& opts_str, |
||||
BlockBasedTableOptions* new_table_options); |
||||
|
||||
Status GetOptionsFromString(const Options& base_options, |
||||
const std::string& opts_str, Options* new_options); |
||||
|
||||
/// Request stopping background work, if wait is true wait until it's done
|
||||
void CancelAllBackgroundWork(DB* db, bool wait = false); |
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
} // namespace rocksdb
|
Loading…
Reference in new issue