Skip to main content

acquire_egress_permit

Function acquire_egress_permit 

Source
fn acquire_egress_permit(
    gate: Option<Arc<ServiceGate>>,
    routing: DestinationRouting,
    data: ApplicationDataOut,
) -> Either<Ready<Result<(DestinationRouting, ApplicationDataOut), Error>>, BoxFuture<'static, Result<(DestinationRouting, ApplicationDataOut), Error>>> ⓘ
Expand description

Passes one outgoing data packet through a Session’s PIX egress gate, if it has one.

Returns a future rather than awaiting so this can sit in a Sink::with without the combinator having to box anything in the common case. The gate answers synchronously whenever service is available — a relaxed load and a compare-exchange — and only the exhausted-budget path allocates, which is a path that is about to block regardless.

A Session that negotiated no PIX passes through with no gate at all, so an un-supervised Session pays one Option check per packet and nothing else.

Nothing is measured on the admitted arm, deliberately. That arm is the steady state at the Session’s full packet rate, and what an operator wants from it — how much was served, and on whose money — is already counted inside the gate’s own compare-exchange and flushed once per supervisor turn by PixSessionTelemetry. Only the refused arm, which is about to allocate a boxed future and block, does any telemetry work of its own.