move convenience.h out of utilities

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/D42201
main
agiardullo 9 years ago
parent beb19ad0dd
commit 81d072623c
  1. 2
      CMakeLists.txt
  2. 2
      db/c.cc
  3. 2
      db/compaction_job_stats_test.cc
  4. 2
      db/convenience.cc
  5. 2
      db/db_test.cc
  6. 63
      include/rocksdb/convenience.h
  7. 57
      include/rocksdb/utilities/convenience.h
  8. 2
      include/utilities/pragma_error.h
  9. 2
      src.mk
  10. 2
      util/options_helper.cc
  11. 2
      util/options_test.cc
  12. 6
      utilities/ttl/db_ttl_impl.cc

@ -75,6 +75,7 @@ set(SOURCES
db/compaction.cc db/compaction.cc
db/compaction_job.cc db/compaction_job.cc
db/compaction_picker.cc db/compaction_picker.cc
db/convenience.cc
db/dbformat.cc db/dbformat.cc
db/db_filesnapshot.cc db/db_filesnapshot.cc
db/db_impl.cc db/db_impl.cc
@ -202,7 +203,6 @@ set(SOURCES
utilities/backupable/backupable_db.cc utilities/backupable/backupable_db.cc
utilities/checkpoint/checkpoint.cc utilities/checkpoint/checkpoint.cc
utilities/compacted_db/compacted_db_impl.cc utilities/compacted_db/compacted_db_impl.cc
utilities/convenience/convenience.cc
utilities/document/document_db.cc utilities/document/document_db.cc
utilities/document/json_document.cc utilities/document/json_document.cc
utilities/document/json_document_builder.cc utilities/document/json_document_builder.cc

@ -16,6 +16,7 @@
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h" #include "rocksdb/compaction_filter.h"
#include "rocksdb/comparator.h" #include "rocksdb/comparator.h"
#include "rocksdb/convenience.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "rocksdb/filter_policy.h" #include "rocksdb/filter_policy.h"
@ -31,7 +32,6 @@
#include "rocksdb/table.h" #include "rocksdb/table.h"
#include "rocksdb/utilities/backupable_db.h" #include "rocksdb/utilities/backupable_db.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "rocksdb/utilities/convenience.h"
using rocksdb::Cache; using rocksdb::Cache;
using rocksdb::ColumnFamilyDescriptor; using rocksdb::ColumnFamilyDescriptor;

@ -30,6 +30,7 @@
#include "port/stack_trace.h" #include "port/stack_trace.h"
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h" #include "rocksdb/compaction_filter.h"
#include "rocksdb/convenience.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "rocksdb/experimental.h" #include "rocksdb/experimental.h"
@ -42,7 +43,6 @@
#include "rocksdb/table_properties.h" #include "rocksdb/table_properties.h"
#include "rocksdb/thread_status.h" #include "rocksdb/thread_status.h"
#include "rocksdb/utilities/checkpoint.h" #include "rocksdb/utilities/checkpoint.h"
#include "rocksdb/utilities/convenience.h"
#include "rocksdb/utilities/write_batch_with_index.h" #include "rocksdb/utilities/write_batch_with_index.h"
#include "table/block_based_table_factory.h" #include "table/block_based_table_factory.h"
#include "table/mock_table.h" #include "table/mock_table.h"

@ -9,7 +9,7 @@
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
#include "rocksdb/utilities/convenience.h" #include "rocksdb/convenience.h"
#include "db/db_impl.h" #include "db/db_impl.h"

@ -33,6 +33,7 @@
#include "port/stack_trace.h" #include "port/stack_trace.h"
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h" #include "rocksdb/compaction_filter.h"
#include "rocksdb/convenience.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "rocksdb/experimental.h" #include "rocksdb/experimental.h"
@ -46,7 +47,6 @@
#include "rocksdb/thread_status.h" #include "rocksdb/thread_status.h"
#include "rocksdb/utilities/write_batch_with_index.h" #include "rocksdb/utilities/write_batch_with_index.h"
#include "rocksdb/utilities/checkpoint.h" #include "rocksdb/utilities/checkpoint.h"
#include "rocksdb/utilities/convenience.h"
#include "rocksdb/utilities/optimistic_transaction_db.h" #include "rocksdb/utilities/optimistic_transaction_db.h"
#include "table/block_based_table_factory.h" #include "table/block_based_table_factory.h"
#include "table/mock_table.h" #include "table/mock_table.h"

@ -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

@ -5,59 +5,8 @@
#pragma once #pragma once
#include <unordered_map> #include "utilities/pragma_error.h"
#include <string>
#include "rocksdb/options.h"
#include "rocksdb/table.h"
namespace rocksdb { ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h")
#ifndef ROCKSDB_LITE #include "rocksdb/convenience.h"
// 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

@ -16,7 +16,7 @@
#if defined(ROCKSDB_PLATFORM_POSIX) #if defined(ROCKSDB_PLATFORM_POSIX)
// Wrap unportable warning macro // Wrap unportable warning macro
#define ROCKSDB_WARNING(x) _Pragma(RDB_STR(GCC warning(x))) #define ROCKSDB_WARNING(x) _Pragma(RDB_STR(GCC warning x))
#elif defined(OS_WIN) #elif defined(OS_WIN)

@ -7,6 +7,7 @@ LIB_SOURCES = \
db/compaction.cc \ db/compaction.cc \
db/compaction_job.cc \ db/compaction_job.cc \
db/compaction_picker.cc \ db/compaction_picker.cc \
db/convenience.cc \
db/db_filesnapshot.cc \ db/db_filesnapshot.cc \
db/dbformat.cc \ db/dbformat.cc \
db/db_impl.cc \ db/db_impl.cc \
@ -96,7 +97,6 @@ LIB_SOURCES = \
util/instrumented_mutex.cc \ util/instrumented_mutex.cc \
util/iostats_context.cc \ util/iostats_context.cc \
utilities/backupable/backupable_db.cc \ utilities/backupable/backupable_db.cc \
utilities/convenience/convenience.cc \
utilities/checkpoint/checkpoint.cc \ utilities/checkpoint/checkpoint.cc \
utilities/document/document_db.cc \ utilities/document/document_db.cc \
utilities/document/json_document_builder.cc \ utilities/document/json_document_builder.cc \

@ -8,12 +8,12 @@
#include <cstdlib> #include <cstdlib>
#include <unordered_set> #include <unordered_set>
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/convenience.h"
#include "rocksdb/filter_policy.h" #include "rocksdb/filter_policy.h"
#include "rocksdb/options.h" #include "rocksdb/options.h"
#include "rocksdb/rate_limiter.h" #include "rocksdb/rate_limiter.h"
#include "rocksdb/slice_transform.h" #include "rocksdb/slice_transform.h"
#include "rocksdb/table.h" #include "rocksdb/table.h"
#include "rocksdb/utilities/convenience.h"
#include "table/block_based_table_factory.h" #include "table/block_based_table_factory.h"
#include "util/logging.h" #include "util/logging.h"
#include "util/options_helper.h" #include "util/options_helper.h"

@ -15,9 +15,9 @@
#include <inttypes.h> #include <inttypes.h>
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/convenience.h"
#include "rocksdb/options.h" #include "rocksdb/options.h"
#include "rocksdb/table.h" #include "rocksdb/table.h"
#include "rocksdb/utilities/convenience.h"
#include "rocksdb/utilities/leveldb_options.h" #include "rocksdb/utilities/leveldb_options.h"
#include "table/block_based_table_factory.h" #include "table/block_based_table_factory.h"
#include "util/random.h" #include "util/random.h"

@ -5,13 +5,13 @@
#include "utilities/ttl/db_ttl_impl.h" #include "utilities/ttl/db_ttl_impl.h"
#include "rocksdb/utilities/convenience.h"
#include "rocksdb/utilities/db_ttl.h"
#include "db/filename.h" #include "db/filename.h"
#include "db/write_batch_internal.h" #include "db/write_batch_internal.h"
#include "util/coding.h" #include "rocksdb/convenience.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "rocksdb/iterator.h" #include "rocksdb/iterator.h"
#include "rocksdb/utilities/db_ttl.h"
#include "util/coding.h"
namespace rocksdb { namespace rocksdb {

Loading…
Cancel
Save