Skip to main content

EgressConfig

Struct EgressConfig 

Source
#[non_exhaustive]
pub struct EgressConfig { pub max_pending_bytes: usize, pub max_hold: Duration, pub drain_timeout: Duration, }
Expand description

Engine-side knobs for action execution. Carried on the session config.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_pending_bytes: usize

Bytes a per-stream pending queue may hold before the read side is stalled. Past this point Delay and Hold are backpressure rather than latency, and the transition is reported once per stream. Default 1 MiB.

§max_hold: Duration

Ceiling on any single Action::Hold and on any single Action::Delay. A clamped delay is reported. Default 30 s.

The ceiling is an Instant deadline, and Instant does not behave the same way across a machine suspend on every platform: a 30 s hold armed before a laptop sleeps may fire immediately on resume (Windows QueryPerformanceCounter) or 30 s after resume (Linux CLOCK_MONOTONIC). Irrelevant on CI; surprising when debugging a run on a laptop.

§drain_timeout: Duration

How long a requested close gives this session’s egress queues to flush before both legs are closed anyway. Default 100 ms.

Only ProxyControl::close_session reads this. Every other way a session ends — a peer going away, a hook’s Action::CloseSession, the proxy being cancelled — tears down at once and has always done so. A requested close is different because somebody is waiting for it to mean something: closing the instant the request lands discards whatever a Delay or a Hold was still holding, and the caller cannot tell that from a session that had nothing queued.

The bound is the point. An unbounded drain turns a close into a call that may never finish: a stream whose destination peer has stopped reading never empties its queue, and a shaped class whose bucket is dry empties it only at the configured rate. Whatever is still queued when this elapses is discarded and reported as ImpairmentKind::QueuedBytesAtTeardown, so bytes that did not make it are named rather than lost quietly, and the close still carries the code that was asked for.

§The default is a guess, and here is the measurement that replaces it

100 ms was chosen because it is long enough for a loopback flush and short enough that a caller closing sessions in a loop does not notice, not because anything was measured. To replace it: pin one queue state — a fixed object size, a fixed unit count, a fixed destination window, written down beside the figure — sweep this timeout across that state, and take the knee at which the stranded byte count reaches zero. Quote the queue state with the number; a knee measured against 4 KiB objects says nothing about 256 KiB ones.

Measure stranded bytes, never elapsed time. Timing the drain measures the fixture that filled the queue — how fast the source wrote, how the destination’s flow-control window happened to open — and a timeout tuned against it is tuned against the harness. The byte count is the thing that is either zero or not.

Trait Implementations§

Source§

impl Clone for EgressConfig

Source§

fn clone(&self) -> EgressConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EgressConfig

Source§

impl Debug for EgressConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EgressConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EgressConfig

Source§

impl PartialEq for EgressConfig

Source§

fn eq(&self, other: &EgressConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EgressConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more