From bff7f5d497c286a745f9e8b887f77e2e2afe766c Mon Sep 17 00:00:00 2001 From: morph <82043364+morph-dev@users.noreply.github.com> Date: Tue, 21 May 2024 18:49:03 +0300 Subject: [PATCH] cm: pr comments --- .../src/versioned/id_indexed_v1/pruning_strategy.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/trin-storage/src/versioned/id_indexed_v1/pruning_strategy.rs b/trin-storage/src/versioned/id_indexed_v1/pruning_strategy.rs index efa0b3bea..9b71c43dd 100644 --- a/trin-storage/src/versioned/id_indexed_v1/pruning_strategy.rs +++ b/trin-storage/src/versioned/id_indexed_v1/pruning_strategy.rs @@ -13,6 +13,10 @@ pub struct PruningConfig { pub target_capacity_fraction: f64, /// The fraction by which we increase/decrease the `max_pruning_count` when pruning duration is /// outside `optimal_pruning_duration_range`. + /// + /// For example, let's assume that value is `0.1`. If pruning is too slow, the + /// `max_pruning_count` will decrease by 10%, while if pruning is too fast, the + /// `max_pruning_count` will increase by 10%. Note that increase and decrease don't cancel out. pub max_pruning_count_change_fraction: f64, /// The range of pruning durations that we consider optimal. pub optimal_pruning_duration_range: Range, @@ -32,7 +36,7 @@ impl PruningConfig { max_pruning_count_change_fraction: f64, optimal_pruning_duration_range: Range, ) -> Self { - if !(0.0..1.0).contains(&target_capacity_fraction) { + if !(0.0..=1.0).contains(&target_capacity_fraction) { panic!( "Invalid pruning strategy parameters: target_capacity_fraction={}", target_capacity_fraction