@@ -18,6 +18,16 @@ const (
1818 KTwoLevelIndexSearchIndexType = 2
1919)
2020
21+ // DataBlockIndexType specifies index type that will be used for the data block.
22+ type DataBlockIndexType uint
23+
24+ const (
25+ // KDataBlockIndexTypeBinarySearch is traditional block type
26+ KDataBlockIndexTypeBinarySearch DataBlockIndexType = 0
27+ // KDataBlockIndexTypeBinarySearchAndHash additional hash index
28+ KDataBlockIndexTypeBinarySearchAndHash DataBlockIndexType = 1
29+ )
30+
2131// BlockBasedTableOptions represents block-based table options.
2232type BlockBasedTableOptions struct {
2333 c * C.rocksdb_block_based_table_options_t
@@ -222,3 +232,16 @@ func (opts *BlockBasedTableOptions) SetFormatVersion(version int) {
222232func (opts * BlockBasedTableOptions ) SetIndexType (value IndexType ) {
223233 C .rocksdb_block_based_options_set_index_type (opts .c , C .int (value ))
224234}
235+
236+ // SetDataBlockIndexType sets data block index type
237+ func (opts * BlockBasedTableOptions ) SetDataBlockIndexType (value DataBlockIndexType ) {
238+ C .rocksdb_block_based_options_set_data_block_index_type (opts .c , C .int (value ))
239+ }
240+
241+ // SetDataBlockHashRatio is valid only when data_block_hash_index_type is
242+ // KDataBlockIndexTypeBinarySearchAndHash.
243+ //
244+ // Default value: 0.75
245+ func (opts * BlockBasedTableOptions ) SetDataBlockHashRatio (value float64 ) {
246+ C .rocksdb_block_based_options_set_data_block_hash_ratio (opts .c , C .double (value ))
247+ }
0 commit comments