pub enum Delivery {
Lossless,
LossyDropNewest,
}Expand description
Backpressure (delivery) policy for a single class of fast-lane events.
The event router forwards fast-lane frames (audio, text, transcripts, thoughts, VAD, phase) over a bounded channel to the fast-lane consumer. When that consumer falls behind and the channel fills, the policy decides what the router does — and crucially, whether the router blocks. Because the router is shared by both the fast lane and the control lane, a blocking fast-lane send stalls routing for all events, including control-lane lifecycle and tool events. The policy lets callers trade frame durability for router responsiveness on a per-class basis.
Variants§
Lossless
Never drop a frame: tx.send(ev).await — the router awaits when the
channel is full. This is the historical (and default) behavior and is
byte-for-byte identical to the pre-policy code path. Use it when every
frame matters and a slow consumer applying backpressure to the router is
acceptable.
LossyDropNewest
Drop the newest frame on overflow: tx.try_send(ev) and, on
TrySendError::Full,
discard the just-produced frame and bump a dropped-frame counter. The
router never blocks on this class, so a slow fast-lane consumer can no
longer stall control-lane routing. Use it for high-frequency, loss-
tolerant streams (e.g. partial transcripts, thoughts) where freshness of
already-queued frames matters less than keeping the router moving.
A drop-oldest / latest-only variant is intentionally not provided:
tokio’s mpsc has no clean “evict the oldest queued item” primitive, so
implementing it correctly would require a custom ring buffer. That is
left as future work rather than shipped half-working.
Trait Implementations§
impl Copy for Delivery
impl Eq for Delivery
impl StructuralPartialEq for Delivery
Auto Trait Implementations§
impl Freeze for Delivery
impl RefUnwindSafe for Delivery
impl Send for Delivery
impl Sync for Delivery
impl Unpin for Delivery
impl UnwindSafe for Delivery
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].