pub struct Leveled { /* private fields */ }Expand description
Leveled compaction strategy (LCS)
When a level reaches some threshold size, parts of it are merged into overlapping tables in the next level.
Each level Ln for n >= 2 can have up to level_base_size * ratio^(n - 1) tables.
LCS suffers from comparatively high write amplification, but has decent read amplification and great space amplification (~1.1x).
LCS is the recommended compaction strategy to use.
More info here: https://fjall-rs.github.io/post/lsm-leveling/
Implementations§
Source§impl Strategy
impl Strategy
Sourcepub fn with_level_ratio_policy(self, policy: Vec<f32>) -> Self
pub fn with_level_ratio_policy(self, policy: Vec<f32>) -> Self
Sets the growth ratio between levels.
Same as set_max_bytes_for_level_multiplier in RocksDB.
Default = [10.0]
Sourcepub fn with_l0_threshold(self, threshold: u8) -> Self
pub fn with_l0_threshold(self, threshold: u8) -> Self
Sets the L0 threshold.
When the number of tables in L0 reaches this threshold, they are merged into L1.
Same as level0_file_num_compaction_trigger in RocksDB.
Default = 4
Sourcepub fn with_table_target_size(self, bytes: u64) -> Self
pub fn with_table_target_size(self, bytes: u64) -> Self
Sets the table target size on disk (possibly compressed).
Same as target_file_size_base in RocksDB.
Default = 64 MiB