pub struct Config {
pub tree_type: TreeType,
pub compression: CompressionType,
pub blob_compression: CompressionType,
pub data_block_size: u32,
pub index_block_size: u32,
pub level_count: u8,
/* private fields */
}
Expand description
Tree configuration builder
Fields§
§tree_type: TreeType
Tree type (unused)
compression: CompressionType
What type of compression is used
blob_compression: CompressionType
What type of compression is used for blobs
data_block_size: u32
Block size of data blocks
index_block_size: u32
Block size of index blocks
level_count: u8
Amount of levels of the LSM tree (depth of tree)
Implementations§
Source§impl Config
impl Config
Sourcepub fn bloom_bits_per_key(self, bits: i8) -> Self
pub fn bloom_bits_per_key(self, bits: i8) -> Self
Sets the bits per key to use for bloom filters in levels that are not L0 or L1.
Use -1 to disable bloom filters even in L0, L1, L2.
Defaults to 10 bits.
§Panics
Panics if n
is less than -1.
Sourcepub fn compression(self, compression: CompressionType) -> Self
pub fn compression(self, compression: CompressionType) -> Self
Sets the compression method.
Using some compression is recommended.
Default = None
Sourcepub fn blob_compression(self, compression: CompressionType) -> Self
pub fn blob_compression(self, compression: CompressionType) -> Self
Sets the compression method.
Using some compression is recommended.
Default = None
Sourcepub fn level_count(self, n: u8) -> Self
pub fn level_count(self, n: u8) -> Self
Sets the amount 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(self, block_size: u32) -> Self
pub fn data_block_size(self, block_size: u32) -> Self
Sets the data block size.
Defaults to 4 KiB (4096 bytes).
For point read heavy workloads (get) a sensible default is somewhere between 4 - 8 KiB, depending on the average value size.
For scan heavy workloads (range, prefix), use 16 - 64 KiB which also increases compression efficiency.
§Panics
Panics if the block size is smaller than 1 KiB or larger than 512 KiB.
Sourcepub fn index_block_size(self, block_size: u32) -> Self
pub fn index_block_size(self, block_size: u32) -> Self
Sets the index block size.
Defaults to 4 KiB (4096 bytes).
For point read heavy workloads (get) a sensible default is somewhere between 4 - 8 KiB, depending on the average value size.
For scan heavy workloads (range, prefix), use 16 - 64 KiB which also increases compression efficiency.
§Panics
Panics if the block size is smaller than 1 KiB or larger than 512 KiB.
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 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.