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 6 #pragma once 7 8 #include <string> 9 #include <unordered_map> 10 11 #include "rocksdb/rocksdb_namespace.h" 12 13 #ifndef ROCKSDB_LITE 14 namespace ROCKSDB_NAMESPACE { 15 // This enum defines the RocksDB options sanity level. 16 enum OptionsSanityCheckLevel : unsigned char { 17 // Performs no sanity check at all. 18 kSanityLevelNone = 0x00, 19 // Performs minimum check to ensure the RocksDB instance can be 20 // opened without corrupting / mis-interpreting the data. 21 kSanityLevelLooselyCompatible = 0x01, 22 // Perform exact match sanity check. 23 kSanityLevelExactMatch = 0xFF, 24 }; 25 26 // The sanity check level for DB options 27 static const std::unordered_map<std::string, OptionsSanityCheckLevel> 28 sanity_level_db_options {}; 29 30 // The sanity check level for column-family options 31 static const std::unordered_map<std::string, OptionsSanityCheckLevel> 32 sanity_level_cf_options = { 33 {"comparator", kSanityLevelLooselyCompatible}, 34 {"table_factory", kSanityLevelLooselyCompatible}, 35 {"merge_operator", kSanityLevelLooselyCompatible}}; 36 37 // The sanity check level for block-based table options 38 static const std::unordered_map<std::string, OptionsSanityCheckLevel> 39 sanity_level_bbt_options {}; 40 41 OptionsSanityCheckLevel DBOptionSanityCheckLevel( 42 const std::string& options_name); 43 OptionsSanityCheckLevel CFOptionSanityCheckLevel( 44 const std::string& options_name); 45 OptionsSanityCheckLevel BBTOptionSanityCheckLevel( 46 const std::string& options_name); 47 48 } // namespace ROCKSDB_NAMESPACE 49 50 #endif // !ROCKSDB_LITE 51