2014-10-10 19:00:12 +02:00
|
|
|
// 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"
|
2014-12-22 22:18:57 +01:00
|
|
|
#include "rocksdb/table.h"
|
2014-10-10 19:00:12 +02:00
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
|
2014-11-13 20:39:30 +01:00
|
|
|
#ifndef ROCKSDB_LITE
|
2014-10-10 19:00:12 +02:00
|
|
|
// Take a map of option name and option value, apply them into the
|
|
|
|
// base_options, and return the new options as a result
|
2014-12-22 22:18:57 +01:00
|
|
|
Status GetColumnFamilyOptionsFromMap(
|
2014-10-10 19:00:12 +02:00
|
|
|
const ColumnFamilyOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& opts_map,
|
|
|
|
ColumnFamilyOptions* new_options);
|
|
|
|
|
2014-12-22 22:18:57 +01:00
|
|
|
Status GetDBOptionsFromMap(
|
2014-10-10 19:00:12 +02:00
|
|
|
const DBOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& opts_map,
|
|
|
|
DBOptions* new_options);
|
|
|
|
|
2014-12-22 22:18:57 +01:00
|
|
|
Status GetBlockBasedTableOptionsFromMap(
|
|
|
|
const BlockBasedTableOptions& table_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& opts_map,
|
|
|
|
BlockBasedTableOptions* new_table_options);
|
|
|
|
|
2014-10-10 19:00:12 +02:00
|
|
|
// 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"
|
2014-12-22 22:18:57 +01:00
|
|
|
// 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(
|
2014-10-10 19:00:12 +02:00
|
|
|
const ColumnFamilyOptions& base_options,
|
|
|
|
const std::string& opts_str,
|
|
|
|
ColumnFamilyOptions* new_options);
|
|
|
|
|
2014-12-22 22:18:57 +01:00
|
|
|
Status GetDBOptionsFromString(
|
2014-10-10 19:00:12 +02:00
|
|
|
const DBOptions& base_options,
|
|
|
|
const std::string& opts_str,
|
|
|
|
DBOptions* new_options);
|
2014-12-22 22:18:57 +01:00
|
|
|
|
|
|
|
Status GetBlockBasedTableOptionsFromString(
|
|
|
|
const BlockBasedTableOptions& table_options,
|
|
|
|
const std::string& opts_str,
|
|
|
|
BlockBasedTableOptions* new_table_options);
|
|
|
|
|
2015-02-20 04:11:14 +01:00
|
|
|
Status GetOptionsFromString(const Options& base_options,
|
|
|
|
const std::string& opts_str, Options* new_options);
|
|
|
|
|
2015-03-11 18:31:02 +01:00
|
|
|
void CancelAllBackgroundWork(DB* db);
|
2014-11-13 20:39:30 +01:00
|
|
|
#endif // ROCKSDB_LITE
|
2014-10-10 19:00:12 +02:00
|
|
|
|
|
|
|
} // namespace rocksdb
|