ndn_strategy/filter.rs
1use crate::context::StrategyContext;
2use ndn_transport::ForwardingAction;
3use smallvec::SmallVec;
4
5/// Post-processes forwarding actions from an inner strategy.
6///
7/// Filters are applied in order by `ComposedStrategy`. Each filter can
8/// reorder, remove, or augment faces in `Forward` actions — for example,
9/// removing faces with RSSI below a threshold.
10///
11/// If a filter removes all faces from a `Forward` action, the composed
12/// strategy falls through to the next action in the list (typically `Nack`
13/// or `Suppress`).
14pub trait StrategyFilter: Send + Sync + 'static {
15 /// Human-readable filter name for logging and debug output.
16 fn name(&self) -> &str;
17
18 /// Transform or prune forwarding actions produced by the inner strategy.
19 fn filter(
20 &self,
21 ctx: &StrategyContext,
22 actions: SmallVec<[ForwardingAction; 2]>,
23 ) -> SmallVec<[ForwardingAction; 2]>;
24}