#[non_exhaustive]pub struct DefragOptions {
pub sparse_threshold: f64,
pub max_values: usize,
}Expand description
Knobs for a defrag pass.
sparse_threshold: fill-density fraction (live_slots / stored_slots)
below which a page is treated as sparse and its values are relocated
(e.g. 0.25 = pages less than 25% dense are compacted). Consumed by
TransactionManager::sparse_data_pages during step 2 of the sweep.
Dense pages above the threshold are left alone — per R3, the cost of
re-packing a mostly-full page exceeds the benefit. Values <= 0
disable the sweep entirely (the sparse set comes back empty).
max_values: soft cap on work per call, so a very large database can
be defragged incrementally across several transactions. 0 means no
limit. The cap counts values relocated, not pages touched. Breaking
the loop early leaves the transaction in a valid state; the caller
chooses commit vs rollback.
I36 (ISSUES.md, 2026-05-22): #[non_exhaustive] so a future
tuning knob (e.g. a per-page time cap, a pages-vs-values-priority
toggle) is not a breaking change. External callers construct via
DefragOptions { ..Default::default() } rather than a full struct
literal.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.sparse_threshold: f64§max_values: usizeImplementations§
Source§impl DefragOptions
impl DefragOptions
pub fn sparse_threshold(self, threshold: f64) -> Self
pub fn max_values(self, cap: usize) -> Self
Trait Implementations§
Source§impl Clone for DefragOptions
impl Clone for DefragOptions
Source§fn clone(&self) -> DefragOptions
fn clone(&self) -> DefragOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more