pub struct Buffer<A, T, TargetRoute, ReplyRoute>where
A: Address,
TargetRoute: DeliveryRoute,
TargetRoute::Protocol: Protocol<Addr = A, Msg = T>,
ReplyRoute: DeliveryRoute,
ReplyRoute::Protocol: Protocol<Addr = A, Msg = BufferOutcome<T>>,{ /* private fields */ }Expand description
Bounded FIFO policy behavior over typed actor deliveries.
State is the named BufferState product. Offers below capacity commit
ownership and report Accepted. At capacity, OverflowPolicy either
returns the new value, or returns the oldest value before accepting the new
one. Release moves exactly the oldest value to the destination lane and
reports the remaining depth; empty release reports Empty. No payload is
silently discarded. Initialization is empty, transitions do not create
actors, and the buffer never terminates itself. FIFO and overflow semantics
are Bombay policy. Physical mailbox buffering, admission, fairness, and
backpressure remain bombay-communication responsibilities. Construction
returns BufferConfigError rather than creating an ownership sink. The
internal full-queue eviction uses the proven invariant that positive
capacity plus the full-offer branch implies a non-empty queue; callers
cannot violate that invariant through the public API.
Implementations§
Source§impl<A, T, TargetRoute, ReplyRoute> Buffer<A, T, TargetRoute, ReplyRoute>where
A: Address,
TargetRoute: DeliveryRoute,
TargetRoute::Protocol: Protocol<Addr = A, Msg = T>,
ReplyRoute: DeliveryRoute,
ReplyRoute::Protocol: Protocol<Addr = A, Msg = BufferOutcome<T>>,
impl<A, T, TargetRoute, ReplyRoute> Buffer<A, T, TargetRoute, ReplyRoute>where
A: Address,
TargetRoute: DeliveryRoute,
TargetRoute::Protocol: Protocol<Addr = A, Msg = T>,
ReplyRoute: DeliveryRoute,
ReplyRoute::Protocol: Protocol<Addr = A, Msg = BufferOutcome<T>>,
Sourcepub fn new(configuration: BufferConfiguration) -> Self
pub fn new(configuration: BufferConfiguration) -> Self
Bind validated policy to an empty buffer actor.
Sourcepub const fn state(&self) -> &BufferState<T, ReplyRoute>
pub const fn state(&self) -> &BufferState<T, ReplyRoute>
Borrow the complete current buffer state.