Struct rocksdb::BlockBasedOptions[][src]

pub struct BlockBasedOptions { /* fields omitted */ }

For configuring block-based file storage.

Implementations

impl BlockBasedOptions[src]

pub fn set_block_size(&mut self, size: usize)[src]

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.

pub fn set_metadata_block_size(&mut self, size: usize)[src]

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.

pub fn set_partition_filters(&mut self, size: bool)[src]

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.

pub fn set_lru_cache(&mut self, size: size_t)[src]

👎 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.

pub fn set_lru_cache_compressed(&mut self, size: size_t)[src]

👎 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.

pub fn set_block_cache(&mut self, cache: &Cache)[src]

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.

pub fn set_block_cache_compressed(&mut self, cache: &Cache)[src]

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

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

pub fn disable_cache(&mut self)[src]

Disable block cache

pub fn set_bloom_filter(&mut self, bits_per_key: c_int, block_based: bool)[src]

Sets the filter policy to reduce disk reads

pub fn set_cache_index_and_filter_blocks(&mut self, v: bool)[src]

pub fn set_index_type(&mut self, index_type: BlockBasedIndexType)[src]

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);

pub fn set_pin_l0_filter_and_index_blocks_in_cache(&mut self, v: bool)[src]

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.

pub fn set_pin_top_level_index_and_filter(&mut self, v: bool)[src]

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.

pub fn set_format_version(&mut self, version: i32)[src]

Format version, reserved for backward compatibility.

See full list of the supported versions.

Default: 2.

pub fn set_block_restart_interval(&mut self, interval: i32)[src]

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.

pub fn set_index_block_restart_interval(&mut self, interval: i32)[src]

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.

pub fn set_data_block_index_type(&mut self, index_type: DataBlockIndexType)[src]

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);

pub fn set_data_block_hash_ratio(&mut self, ratio: f64)[src]

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

impl Default for BlockBasedOptions[src]

impl Drop for BlockBasedOptions[src]

impl Send for BlockBasedOptions[src]

impl Sync for BlockBasedOptions[src]

Auto Trait Implementations

impl RefUnwindSafe for BlockBasedOptions

impl Unpin for BlockBasedOptions

impl UnwindSafe for BlockBasedOptions

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.