pub struct Pruner {
policy: PruningPolicy,
preserved: HashSet<Hash>,
stable_frontier: Option<VersionVector>,
}Expand description
Pruner for removing old DAG nodes.
Fields§
§policy: PruningPolicyPruning policy.
preserved: HashSet<Hash>Set of CIDs that must be preserved (e.g., recent snapshots).
stable_frontier: Option<VersionVector>The stable frontier at the time of pruning.
Implementations§
Source§impl Pruner
impl Pruner
Sourcepub fn with_policy(policy: PruningPolicy) -> Self
pub fn with_policy(policy: PruningPolicy) -> Self
Create a pruner with custom policy.
Sourcepub fn policy(&self) -> &PruningPolicy
pub fn policy(&self) -> &PruningPolicy
Get the current policy.
Sourcepub fn set_stable_frontier(&mut self, frontier: VersionVector)
pub fn set_stable_frontier(&mut self, frontier: VersionVector)
Set the stable frontier for pruning decisions.
Sourcepub fn clear_preserved(&mut self)
pub fn clear_preserved(&mut self)
Clear preserved CIDs.
Sourcepub fn identify_prunable<S: DAGStore>(
&self,
store: &S,
snapshot: &Snapshot,
current_time: u64,
) -> Vec<Hash>
pub fn identify_prunable<S: DAGStore>( &self, store: &S, snapshot: &Snapshot, current_time: u64, ) -> Vec<Hash>
Identify nodes that can be safely pruned.
This doesn’t actually modify the store - it returns the list of
nodes that would be pruned if execute_prune is called.
Sourcepub fn execute_prune<S: DAGStore + PrunableStore>(
&self,
store: &mut S,
snapshot: &Snapshot,
current_time: u64,
) -> PruningResult
pub fn execute_prune<S: DAGStore + PrunableStore>( &self, store: &mut S, snapshot: &Snapshot, current_time: u64, ) -> PruningResult
Execute pruning on a mutable store.
Returns the result of the pruning operation.
Sourcepub fn should_prune<S: DAGStore>(
&self,
store: &S,
snapshot: &Snapshot,
stability_monitor: Option<&StabilityMonitor>,
) -> bool
pub fn should_prune<S: DAGStore>( &self, store: &S, snapshot: &Snapshot, stability_monitor: Option<&StabilityMonitor>, ) -> bool
Check if pruning should be performed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pruner
impl RefUnwindSafe for Pruner
impl Send for Pruner
impl Sync for Pruner
impl Unpin for Pruner
impl UnwindSafe for Pruner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more