@ -35,22 +35,8 @@
// OPTIONS files.
// OPTIONS files.
namespace ROCKSDB_NAMESPACE {
namespace ROCKSDB_NAMESPACE {
// offset_of is used to get the offset of a class data member
// ex: offset_of(&ColumnFamilyOptions::num_levels)
// This call will return the offset of num_levels in ColumnFamilyOptions class
//
// This is the same as offsetof() but allow us to work with non standard-layout
// classes and structures
// refs:
// http://en.cppreference.com/w/cpp/concept/StandardLayoutType
// https://gist.github.com/graphitemaster/494f21190bb2c63c5516
# ifndef ROCKSDB_LITE
static ImmutableCFOptions dummy_cf_options ;
template < typename T1 >
int offset_of ( T1 ImmutableCFOptions : : * member ) {
return int ( size_t ( & ( dummy_cf_options . * member ) ) - size_t ( & dummy_cf_options ) ) ;
}
# ifndef ROCKSDB_LITE
static Status ParseCompressionOptions ( const std : : string & value ,
static Status ParseCompressionOptions ( const std : : string & value ,
const std : : string & name ,
const std : : string & name ,
CompressionOptions & compression_opts ) {
CompressionOptions & compression_opts ) {
@ -518,19 +504,20 @@ static std::unordered_map<std::string, OptionTypeInfo>
{ 0 , OptionType : : kBoolean , OptionVerificationType : : kDeprecated ,
{ 0 , OptionType : : kBoolean , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " inplace_update_support " ,
{ " inplace_update_support " ,
{ offset_of ( & ImmutableCFOptions : : inplace_update_support ) ,
{ offsetof ( struct ImmutableCFOptions , inplace_update_support ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " level_compaction_dynamic_level_bytes " ,
{ " level_compaction_dynamic_level_bytes " ,
{ offset_of ( & ImmutableCFOptions : : level_compaction_dynamic_level_bytes ) ,
{ offsetof ( struct ImmutableCFOptions ,
level_compaction_dynamic_level_bytes ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " optimize_filters_for_hits " ,
{ " optimize_filters_for_hits " ,
{ offset_of ( & ImmutableCFOptions : : optimize_filters_for_hits ) ,
{ offsetof ( struct ImmutableCFOptions , optimize_filters_for_hits ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " force_consistency_checks " ,
{ " force_consistency_checks " ,
{ offset_of ( & ImmutableCFOptions : : force_consistency_checks ) ,
{ offsetof ( struct ImmutableCFOptions , force_consistency_checks ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
// Need to keep this around to be able to read old OPTIONS files.
// Need to keep this around to be able to read old OPTIONS files.
@ -538,34 +525,37 @@ static std::unordered_map<std::string, OptionTypeInfo>
{ 0 , OptionType : : kInt , OptionVerificationType : : kDeprecated ,
{ 0 , OptionType : : kInt , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " max_write_buffer_number_to_maintain " ,
{ " max_write_buffer_number_to_maintain " ,
{ offset_of ( & ImmutableCFOptions : : max_write_buffer_number_to_maintain ) ,
{ offsetof ( struct ImmutableCFOptions ,
max_write_buffer_number_to_maintain ) ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone , 0 } } ,
OptionTypeFlags : : kNone , 0 } } ,
{ " max_write_buffer_size_to_maintain " ,
{ " max_write_buffer_size_to_maintain " ,
{ offset_of ( & ImmutableCFOptions : : max_write_buffer_size_to_maintain ) ,
{ offsetof ( struct ImmutableCFOptions ,
max_write_buffer_size_to_maintain ) ,
OptionType : : kInt64T , OptionVerificationType : : kNormal ,
OptionType : : kInt64T , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " min_write_buffer_number_to_merge " ,
{ " min_write_buffer_number_to_merge " ,
{ offset_of ( & ImmutableCFOptions : : min_write_buffer_number_to_merge ) ,
{ offsetof ( struct ImmutableCFOptions , min_write_buffer_number_to_merge ) ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone , 0 } } ,
OptionTypeFlags : : kNone , 0 } } ,
{ " num_levels " ,
{ " num_levels " ,
{ offset_of ( & ImmutableCFOptions : : num_levels ) , OptionType : : kInt ,
{ offsetof ( struct ImmutableCFOptions , num_levels ) , OptionType : : kInt ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone } } ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone } } ,
{ " bloom_locality " ,
{ " bloom_locality " ,
{ offset_of ( & ImmutableCFOptions : : bloom_locality ) , OptionType : : kUInt32T ,
{ offsetof ( struct ImmutableCFOptions , bloom_locality ) ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone } } ,
OptionType : : kUInt32T , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " rate_limit_delay_max_milliseconds " ,
{ " rate_limit_delay_max_milliseconds " ,
{ 0 , OptionType : : kUInt , OptionVerificationType : : kDeprecated ,
{ 0 , OptionType : : kUInt , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " compression_per_level " ,
{ " compression_per_level " ,
OptionTypeInfo : : Vector < CompressionType > (
OptionTypeInfo : : Vector < CompressionType > (
offset_of ( & ImmutableCFOptions : : compression_per_level ) ,
offsetof ( struct ImmutableCFOptions , compression_per_level ) ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone ,
{ 0 , OptionType : : kCompressionType } ) } ,
{ 0 , OptionType : : kCompressionType } ) } ,
{ " comparator " ,
{ " comparator " ,
OptionTypeInfo : : AsCustomRawPtr < const Comparator > (
OptionTypeInfo : : AsCustomRawPtr < const Comparator > (
offset_of ( & ImmutableCFOptions : : user_comparator ) ,
offsetof ( struct ImmutableCFOptions , user_comparator ) ,
OptionVerificationType : : kByName , OptionTypeFlags : : kCompareLoose ,
OptionVerificationType : : kByName , OptionTypeFlags : : kCompareLoose ,
// Serializes a Comparator
// Serializes a Comparator
[ ] ( const ConfigOptions & opts , const std : : string & , const void * addr ,
[ ] ( const ConfigOptions & opts , const std : : string & , const void * addr ,
@ -592,11 +582,11 @@ static std::unordered_map<std::string, OptionTypeInfo>
/* Use the default match function*/ nullptr ) } ,
/* Use the default match function*/ nullptr ) } ,
{ " memtable_insert_with_hint_prefix_extractor " ,
{ " memtable_insert_with_hint_prefix_extractor " ,
OptionTypeInfo : : AsCustomSharedPtr < const SliceTransform > (
OptionTypeInfo : : AsCustomSharedPtr < const SliceTransform > (
offset_of ( & ImmutableCFOptions : :
offsetof ( struct ImmutableCFOptions ,
memtable_insert_with_hint_prefix_extractor ) ,
memtable_insert_with_hint_prefix_extractor ) ,
OptionVerificationType : : kByNameAllowNull , OptionTypeFlags : : kNone ) } ,
OptionVerificationType : : kByNameAllowNull , OptionTypeFlags : : kNone ) } ,
{ " memtable_factory " ,
{ " memtable_factory " ,
{ offset_of ( & ImmutableCFOptions : : memtable_factory ) ,
{ offsetof ( struct ImmutableCFOptions , memtable_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kByName ,
OptionType : : kCustomizable , OptionVerificationType : : kByName ,
OptionTypeFlags : : kShared ,
OptionTypeFlags : : kShared ,
[ ] ( const ConfigOptions & opts , const std : : string & ,
[ ] ( const ConfigOptions & opts , const std : : string & ,
@ -612,7 +602,7 @@ static std::unordered_map<std::string, OptionTypeInfo>
return s ;
return s ;
} } } ,
} } } ,
{ " memtable " ,
{ " memtable " ,
{ offset_of ( & ImmutableCFOptions : : memtable_factory ) ,
{ offsetof ( struct ImmutableCFOptions , memtable_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kShared ,
OptionTypeFlags : : kShared ,
[ ] ( const ConfigOptions & opts , const std : : string & ,
[ ] ( const ConfigOptions & opts , const std : : string & ,
@ -627,14 +617,15 @@ static std::unordered_map<std::string, OptionTypeInfo>
}
}
return s ;
return s ;
} } } ,
} } } ,
{ " table_factory " , OptionTypeInfo : : AsCustomSharedPtr < TableFactory > (
{ " table_factory " ,
offset_of ( & ImmutableCFOptions : : table_factory ) ,
OptionTypeInfo : : AsCustomSharedPtr < TableFactory > (
offsetof ( struct ImmutableCFOptions , table_factory ) ,
OptionVerificationType : : kByName ,
OptionVerificationType : : kByName ,
( OptionTypeFlags : : kCompareLoose |
( OptionTypeFlags : : kCompareLoose |
OptionTypeFlags : : kStringNameOnly |
OptionTypeFlags : : kStringNameOnly |
OptionTypeFlags : : kDontPrepare ) ) } ,
OptionTypeFlags : : kDontPrepare ) ) } ,
{ " block_based_table_factory " ,
{ " block_based_table_factory " ,
{ offset_of ( & ImmutableCFOptions : : table_factory ) ,
{ offsetof ( struct ImmutableCFOptions , table_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
// Parses the input value and creates a BlockBasedTableFactory
// Parses the input value and creates a BlockBasedTableFactory
@ -666,7 +657,7 @@ static std::unordered_map<std::string, OptionTypeInfo>
}
}
} } } ,
} } } ,
{ " plain_table_factory " ,
{ " plain_table_factory " ,
{ offset_of ( & ImmutableCFOptions : : table_factory ) ,
{ offsetof ( struct ImmutableCFOptions , table_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
// Parses the input value and creates a PlainTableFactory
// Parses the input value and creates a PlainTableFactory
@ -699,35 +690,35 @@ static std::unordered_map<std::string, OptionTypeInfo>
{ " table_properties_collectors " ,
{ " table_properties_collectors " ,
OptionTypeInfo : : Vector <
OptionTypeInfo : : Vector <
std : : shared_ptr < TablePropertiesCollectorFactory > > (
std : : shared_ptr < TablePropertiesCollectorFactory > > (
offset_ of (
offsetof ( struct ImmutableCFOptions ,
& ImmutableCFOptions : : table_properties_collector_factories ) ,
table_properties_collector_factories ) ,
OptionVerificationType : : kByName , OptionTypeFlags : : kNone ,
OptionVerificationType : : kByName , OptionTypeFlags : : kNone ,
OptionTypeInfo : : AsCustomSharedPtr < TablePropertiesCollectorFactory > (
OptionTypeInfo : : AsCustomSharedPtr < TablePropertiesCollectorFactory > (
0 , OptionVerificationType : : kByName , OptionTypeFlags : : kNone ) ) } ,
0 , OptionVerificationType : : kByName , OptionTypeFlags : : kNone ) ) } ,
{ " compaction_filter " ,
{ " compaction_filter " ,
OptionTypeInfo : : AsCustomRawPtr < const CompactionFilter > (
OptionTypeInfo : : AsCustomRawPtr < const CompactionFilter > (
offset_of ( & ImmutableCFOptions : : compaction_filter ) ,
offsetof ( struct ImmutableCFOptions , compaction_filter ) ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
{ " compaction_filter_factory " ,
{ " compaction_filter_factory " ,
OptionTypeInfo : : AsCustomSharedPtr < CompactionFilterFactory > (
OptionTypeInfo : : AsCustomSharedPtr < CompactionFilterFactory > (
offset_of ( & ImmutableCFOptions : : compaction_filter_factory ) ,
offsetof ( struct ImmutableCFOptions , compaction_filter_factory ) ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
{ " merge_operator " ,
{ " merge_operator " ,
OptionTypeInfo : : AsCustomSharedPtr < MergeOperator > (
OptionTypeInfo : : AsCustomSharedPtr < MergeOperator > (
offset_of ( & ImmutableCFOptions : : merge_operator ) ,
offsetof ( struct ImmutableCFOptions , merge_operator ) ,
OptionVerificationType : : kByNameAllowFromNull ,
OptionVerificationType : : kByNameAllowFromNull ,
OptionTypeFlags : : kCompareLoose | OptionTypeFlags : : kAllowNull ) } ,
OptionTypeFlags : : kCompareLoose | OptionTypeFlags : : kAllowNull ) } ,
{ " compaction_style " ,
{ " compaction_style " ,
{ offset_of ( & ImmutableCFOptions : : compaction_style ) ,
{ offsetof ( struct ImmutableCFOptions , compaction_style ) ,
OptionType : : kCompactionStyle , OptionVerificationType : : kNormal ,
OptionType : : kCompactionStyle , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " compaction_pri " ,
{ " compaction_pri " ,
{ offset_of ( & ImmutableCFOptions : : compaction_pri ) ,
{ offsetof ( struct ImmutableCFOptions , compaction_pri ) ,
OptionType : : kCompactionPri , OptionVerificationType : : kNormal ,
OptionType : : kCompactionPri , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
OptionTypeFlags : : kNone } } ,
{ " sst_partitioner_factory " ,
{ " sst_partitioner_factory " ,
OptionTypeInfo : : AsCustomSharedPtr < SstPartitionerFactory > (
OptionTypeInfo : : AsCustomSharedPtr < SstPartitionerFactory > (
offset_of ( & ImmutableCFOptions : : sst_partitioner_factory ) ,
offsetof ( struct ImmutableCFOptions , sst_partitioner_factory ) ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
OptionVerificationType : : kByName , OptionTypeFlags : : kAllowNull ) } ,
} ;
} ;