options_sanity_check.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #ifndef ROCKSDB_LITE
  6. #include "options/options_sanity_check.h"
  7. namespace ROCKSDB_NAMESPACE {
  8. namespace {
  9. OptionsSanityCheckLevel SanityCheckLevelHelper(
  10. const std::unordered_map<std::string, OptionsSanityCheckLevel>& smap,
  11. const std::string& name) {
  12. auto iter = smap.find(name);
  13. return iter != smap.end() ? iter->second : kSanityLevelExactMatch;
  14. }
  15. }
  16. OptionsSanityCheckLevel DBOptionSanityCheckLevel(
  17. const std::string& option_name) {
  18. return SanityCheckLevelHelper(sanity_level_db_options, option_name);
  19. }
  20. OptionsSanityCheckLevel CFOptionSanityCheckLevel(
  21. const std::string& option_name) {
  22. return SanityCheckLevelHelper(sanity_level_cf_options, option_name);
  23. }
  24. OptionsSanityCheckLevel BBTOptionSanityCheckLevel(
  25. const std::string& option_name) {
  26. return SanityCheckLevelHelper(sanity_level_bbt_options, option_name);
  27. }
  28. } // namespace ROCKSDB_NAMESPACE
  29. #endif // !ROCKSDB_LITE