pub struct Deduplicator<A: Address, K, T, TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>, ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = DeduplicatorOutcome<K, T>>>> { /* private fields */ }Expand description
Bounded, deterministic first-seen delivery behavior.
A retained key rejects delivery and returns the owned payload. A new key is committed before its delivery is emitted; when retention is full, the oldest key is returned in the result before the new key becomes newest. Duplicate attempts do not refresh retention. Initialization is empty, the fold creates no actors, and it never terminates by policy. The finite FIFO retention window is deliberate Bombay policy and makes the limitation of deduplication explicit: an evicted key can be accepted again. Physical mailbox delivery remains a runtime responsibility. Construction rejects zero capacity and transitions have no panic path.
Implementations§
Source§impl<A, K, T, TargetRoute, ReplyRoute> Deduplicator<A, K, T, TargetRoute, ReplyRoute>where
A: Address,
K: Clone + Eq,
TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>,
ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = DeduplicatorOutcome<K, T>>>,
impl<A, K, T, TargetRoute, ReplyRoute> Deduplicator<A, K, T, TargetRoute, ReplyRoute>where
A: Address,
K: Clone + Eq,
TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>,
ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = DeduplicatorOutcome<K, T>>>,
Sourcepub fn new(capacity: usize) -> Result<Self, DeduplicatorConfigError>
pub fn new(capacity: usize) -> Result<Self, DeduplicatorConfigError>
Construct empty positive bounded retention.
§Errors
Returns DeduplicatorConfigError::ZeroCapacity for zero capacity.
Sourcepub fn state(&self) -> DeduplicatorState<K>
pub fn state(&self) -> DeduplicatorState<K>
Return a snapshot of the complete retention policy state.