pub struct Config {Show 13 fields
pub tree_type: TreeType,
pub level_count: u8,
pub data_block_compression_policy: CompressionPolicy,
pub index_block_compression_policy: CompressionPolicy,
pub data_block_restart_interval_policy: RestartIntervalPolicy,
pub index_block_restart_interval_policy: RestartIntervalPolicy,
pub data_block_size_policy: BlockSizePolicy,
pub index_block_size_policy: BlockSizePolicy,
pub index_block_pinning_policy: PinningPolicy,
pub filter_block_pinning_policy: PinningPolicy,
pub data_block_hash_ratio_policy: HashRatioPolicy,
pub filter_policy: FilterPolicy,
pub blob_compression: CompressionType,
/* private fields */
}
Expand description
Tree configuration builder
Fields§
§tree_type: TreeType
Tree type (unused)
level_count: u8
Number of levels of the LSM tree (depth of tree)
Once set, the level count is fixed (in the “manifest” file)
data_block_compression_policy: CompressionPolicy
What type of compression is used for data blocks
index_block_compression_policy: CompressionPolicy
What type of compression is used for index blocks
data_block_restart_interval_policy: RestartIntervalPolicy
Restart interval inside data blocks
index_block_restart_interval_policy: RestartIntervalPolicy
Restart interval inside index blocks
data_block_size_policy: BlockSizePolicy
Block size of data blocks
index_block_size_policy: BlockSizePolicy
Block size of index blocks
index_block_pinning_policy: PinningPolicy
Whether to pin index blocks
filter_block_pinning_policy: PinningPolicy
Whether to pin filter blocks
data_block_hash_ratio_policy: HashRatioPolicy
Data block hash ratio
filter_policy: FilterPolicy
Filter construction policy
blob_compression: CompressionType
What type of compression is used for blobs
Implementations§
Source§impl Config
impl Config
Sourcepub fn use_cache(self, cache: Arc<Cache>) -> Self
pub fn use_cache(self, cache: Arc<Cache>) -> Self
Sets the global cache.
You can create a global Cache
and share it between multiple
trees to cap global cache memory usage.
Defaults to a cache with 8 MiB of capacity per tree.
Sourcepub fn expect_point_read_hits(self, b: bool) -> Self
pub fn expect_point_read_hits(self, b: bool) -> Self
If true
, the last level will not build filters, reducing the filter size of a database
by ~90% typically.
Enable this only if you know that point reads generally are expected to find a key-value pair.
Sourcepub fn filter_block_pinning_policy(self, policy: PinningPolicy) -> Self
pub fn filter_block_pinning_policy(self, policy: PinningPolicy) -> Self
Sets the pinning policy for filter blocks.
Sourcepub fn index_block_pinning_policy(self, policy: PinningPolicy) -> Self
pub fn index_block_pinning_policy(self, policy: PinningPolicy) -> Self
Sets the pinning policy for index blocks.
Sourcepub fn data_block_restart_interval_policy(
self,
policy: RestartIntervalPolicy,
) -> Self
pub fn data_block_restart_interval_policy( self, policy: RestartIntervalPolicy, ) -> Self
Sets the restart interval inside data blocks.
A higher restart interval saves space while increasing lookup times inside data blocks.
Default = 16
Sourcepub fn index_block_restart_interval_policy(
self,
policy: RestartIntervalPolicy,
) -> Self
pub fn index_block_restart_interval_policy( self, policy: RestartIntervalPolicy, ) -> Self
Sets the restart interval inside index blocks.
A higher restart interval saves space while increasing lookup times inside index blocks.
Default = 1
Sourcepub fn filter_policy(self, policy: FilterPolicy) -> Self
pub fn filter_policy(self, policy: FilterPolicy) -> Self
Sets the filter construction policy.
Sourcepub fn data_block_compression_policy(self, policy: CompressionPolicy) -> Self
pub fn data_block_compression_policy(self, policy: CompressionPolicy) -> Self
Sets the compression method for data blocks.
Sourcepub fn index_block_compression_policy(self, policy: CompressionPolicy) -> Self
pub fn index_block_compression_policy(self, policy: CompressionPolicy) -> Self
Sets the compression method for index blocks.
Sourcepub fn blob_compression(self, compression: CompressionType) -> Self
pub fn blob_compression(self, compression: CompressionType) -> Self
Sets the blob compression method.
Sourcepub fn level_count(self, n: u8) -> Self
pub fn level_count(self, n: u8) -> Self
Sets the number of levels of the LSM tree (depth of tree).
Defaults to 7, like LevelDB
and RocksDB
.
Cannot be changed once set.
§Panics
Panics if n
is 0.
Sourcepub fn data_block_size_policy(self, policy: BlockSizePolicy) -> Self
pub fn data_block_size_policy(self, policy: BlockSizePolicy) -> Self
Sets the data block size policy.
Sourcepub fn index_block_size_policy(self, policy: BlockSizePolicy) -> Self
pub fn index_block_size_policy(self, policy: BlockSizePolicy) -> Self
Sets the index block size policy.
Sourcepub fn data_block_hash_ratio_policy(self, policy: HashRatioPolicy) -> Self
pub fn data_block_hash_ratio_policy(self, policy: HashRatioPolicy) -> Self
Sets the hash ratio policy for data blocks.
If greater than 0.0, a hash index is embedded into data blocks that can speed up reads inside the data block.
Sourcepub fn blob_file_target_size(self, bytes: u64) -> Self
pub fn blob_file_target_size(self, bytes: u64) -> Self
Sets the target size of blob files.
Smaller blob files allow more granular garbage collection which allows lower space amp for lower write I/O cost.
Larger blob files decrease the number of files on disk and maintenance overhead.
Defaults to 64 MiB.
This option has no effect when not used for opening a blob tree.
Sourcepub fn blob_file_separation_threshold(self, bytes: u32) -> Self
pub fn blob_file_separation_threshold(self, bytes: u32) -> Self
Sets the key-value separation threshold in bytes.
Smaller value will reduce compaction overhead and thus write amplification, at the cost of lower read performance.
Defaults to 4KiB.
This option has no effect when not used for opening a blob tree.