pub struct BlockBasedOptions { /* private fields */ }
Expand description

For configuring block-based file storage.

Implementations

Approximate size of user data packed per block. Note that the block size specified here corresponds to uncompressed data. The actual size of the unit read from disk may be smaller if compression is enabled. This parameter can be changed dynamically.

Block size for partitioned metadata. Currently applied to indexes when kTwoLevelIndexSearch is used and to filters when partition_filters is used. Note: Since in the current implementation the filters and index partitions are aligned, an index/filter block is created when either index or filter block size reaches the specified limit.

Note: this limit is currently applied to only index blocks; a filter partition is cut right after an index block is cut.

Note: currently this option requires kTwoLevelIndexSearch to be set as well.

Use partitioned full filters for each SST file. This option is incompatible with block-based filters.

👎 Deprecated since 0.15.0:

This function will be removed in next release. Use set_block_cache instead

When provided: use the specified cache for blocks. Otherwise rocksdb will automatically create and use an 8MB internal cache.

👎 Deprecated since 0.15.0:

This function will be removed in next release. Use set_block_cache_compressed instead

When configured: use the specified cache for compressed blocks. Otherwise rocksdb will not use a compressed block cache.

Note: though it looks similar to block_cache, RocksDB doesn’t put the same type of object there.

Sets global cache for blocks (user data is stored in a set of blocks, and a block is the unit of reading from disk). Cache must outlive DB instance which uses it.

If set, use the specified cache for blocks. By default, rocksdb will automatically create and use an 8MB internal cache.

Sets global cache for compressed blocks. Cache must outlive DB instance which uses it.

By default, rocksdb will not use a compressed block cache.

Disable block cache

Sets the filter policy to reduce disk reads

Defines the index type to be used for SS-table lookups.

Examples
use rocksdb::{BlockBasedOptions, BlockBasedIndexType, Options};

let mut opts = Options::default();
let mut block_opts = BlockBasedOptions::default();
block_opts.set_index_type(BlockBasedIndexType::HashSearch);

If cache_index_and_filter_blocks is true and the below is true, then filter and index blocks are stored in the cache, but a reference is held in the “table reader” object so the blocks are pinned and only evicted from cache when the table reader is freed.

Default: false.

If cache_index_and_filter_blocks is true and the below is true, then the top-level index of partitioned filter and index blocks are stored in the cache, but a reference is held in the “table reader” object so the blocks are pinned and only evicted from cache when the table reader is freed. This is not limited to l0 in LSM tree.

Default: false.

Format version, reserved for backward compatibility.

See full list of the supported versions.

Default: 2.

Number of keys between restart points for delta encoding of keys. This parameter can be changed dynamically. Most clients should leave this parameter alone. The minimum value allowed is 1. Any smaller value will be silently overwritten with 1.

Default: 16.

Same as block_restart_interval but used for the index block. If you don’t plan to run RocksDB before version 5.16 and you are using index_block_restart_interval > 1, you should probably set the format_version to >= 4 as it would reduce the index size.

Default: 1.

Set the data block index type for point lookups: DataBlockIndexType::BinarySearch to use binary search within the data block. DataBlockIndexType::BinaryAndHash to use the data block hash index in combination with the normal binary search.

The hash table utilization ratio is adjustable using set_data_block_hash_ratio, which is valid only when using DataBlockIndexType::BinaryAndHash.

Default: BinarySearch

Examples
use rocksdb::{BlockBasedOptions, DataBlockIndexType, Options};

let mut opts = Options::default();
let mut block_opts = BlockBasedOptions::default();
block_opts.set_data_block_index_type(DataBlockIndexType::BinaryAndHash);
block_opts.set_data_block_hash_ratio(0.85);

Set the data block hash index utilization ratio.

The smaller the utilization ratio, the less hash collisions happen, and so reduce the risk for a point lookup to fall back to binary search due to the collisions. A small ratio means faster lookup at the price of more space overhead.

Default: 0.75

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.