Skip to main content

blocks_per_file_for_prune_distance

Function blocks_per_file_for_prune_distance 

Source
pub const fn blocks_per_file_for_prune_distance(distance: u64) -> u64
Expand description

Derives the number of blocks per static file for a segment that is pruned with a distance prune mode.

Static file segments are pruned by deleting whole files, so the file size bounds how much data is retained beyond the configured distance: a file only becomes deletable once the prune target has moved past its end. A quarter of the distance keeps the worst-case retention overshoot at ~25% while only a handful of files are live at any time. The result is clamped to avoid excessive file churn for small distances and is never larger than DEFAULT_BLOCKS_PER_STATIC_FILE.