Add GetSupportedCompressions() convenience function

Summary:
This function will return a list of supported compression types in RocksDB
This is needed for MyRocks https://github.com/facebook/mysql-5.6/pull/446
Closes https://github.com/facebook/rocksdb/pull/1747

Differential Revision: D4385921

Pulled By: IslamAbdelRahman

fbshipit-source-id: 2f5b59f
main
Islam AbdelRahman 8 years ago committed by Facebook Github Bot
parent b104b87814
commit ac73d7558b
  1. 2
      include/rocksdb/convenience.h
  2. 11
      util/options_helper.cc

@ -288,6 +288,8 @@ Status GetStringFromColumnFamilyOptions(std::string* opts_str,
Status GetStringFromCompressionType(std::string* compression_str, Status GetStringFromCompressionType(std::string* compression_str,
CompressionType compression_type); CompressionType compression_type);
std::vector<CompressionType> GetSupportedCompressions();
Status GetBlockBasedTableOptionsFromString( Status GetBlockBasedTableOptionsFromString(
const BlockBasedTableOptions& table_options, const BlockBasedTableOptions& table_options,
const std::string& opts_str, const std::string& opts_str,

@ -1080,6 +1080,17 @@ Status GetStringFromCompressionType(std::string* compression_str,
} }
} }
std::vector<CompressionType> GetSupportedCompressions() {
std::vector<CompressionType> supported_compressions;
for (const auto& comp_to_name : compression_type_string_map) {
CompressionType t = comp_to_name.second;
if (t != kDisableCompressionOption && CompressionTypeSupported(t)) {
supported_compressions.push_back(t);
}
}
return supported_compressions;
}
bool SerializeSingleBlockBasedTableOption( bool SerializeSingleBlockBasedTableOption(
std::string* opt_string, const BlockBasedTableOptions& bbt_options, std::string* opt_string, const BlockBasedTableOptions& bbt_options,
const std::string& name, const std::string& delimiter) { const std::string& name, const std::string& delimiter) {

Loading…
Cancel
Save