pub struct ResponsePermit { /* private fields */ }Expand description
Reservation for the downstream response-capture worker job. Draws
from a distinct capacity semaphore so operators can tell via
av_events_dropped_total{stage="response_slot"} vs
stage="worker_queue" which class of admission is the bottleneck.
Unlike WorkerPermit, the response permit only holds the
capacity semaphore — the mpsc queue slot is re-acquired at submit
time via Self::submit. This keeps the initial admission cheap
(one semaphore acquire instead of two mpsc reservations that would
otherwise compete for the same shard’s slot with the worker
permit) and lets the response job land whenever worker capacity
and the shard have room, which is the common case since response
capture happens
tens-of-seconds after the initial worker job has drained.
Held by the streaming-response wrapper in routes.rs
(AbortFinalizingStream) for the lifetime of the forwarded response;
drops on stream completion or client abort.
Implementations§
Source§impl ResponsePermit
impl ResponsePermit
Sourcepub fn submit(
self,
worker: &WorkerHandle,
job: WorkerJob,
) -> Result<(), SubmitError>
pub fn submit( self, worker: &WorkerHandle, job: WorkerJob, ) -> Result<(), SubmitError>
Commit a response-capture job. Consumes the response permit’s
capacity slot and races for a shard’s mpsc slot; if the shard is
momentarily full, returns a SubmitError::Full and bumps
av_events_dropped_total{stage="response_slot"} — NOT the
worker_queue counter. That distinction is the whole point of
the split: operators need to see which class of exhaustion is
producing drops.
Auto Trait Implementations§
impl Freeze for ResponsePermit
impl !RefUnwindSafe for ResponsePermit
impl Send for ResponsePermit
impl Sync for ResponsePermit
impl Unpin for ResponsePermit
impl UnsafeUnpin for ResponsePermit
impl !UnwindSafe for ResponsePermit
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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