pub struct Pick { /* private fields */ }Expand description
A chosen instance plus a guard tracking its load (ADR 000035). For least_request the guard
holds the selected instance’s incremented active-request count and decrements it on drop — on
EVERY forward return path (success, retry, transport error) and on each retry hand-off, because
replacing the Pick drops the previous guard. For round-robin / maglev the guard is a no-op.
Derefs to the instance so callers read address() / is_healthy() directly.
Implementations§
Methods from Deref<Target = UpstreamInstance>§
Sourcepub fn in_flight(&self) -> usize
pub fn in_flight(&self) -> usize
Current active forwarded-request count to this instance (ADR 000035) — the least-request load signal. Lock-free read.
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Whether this instance is currently in rotation. Lock-free — the round-robin hot path.
Sourcepub fn is_outlier_ejected(&self, now_ms: u64) -> bool
pub fn is_outlier_ejected(&self, now_ms: u64) -> bool
Whether this instance is currently outlier-ejected at now_ms (ADR 000032). Lock-free — the
pick hot path. The ejection auto-expires when its window passes (no probe needed); this is a
distinct axis from is_healthy (an instance can be probe-healthy yet outlier-ejected).
Sourcepub fn record_probe_success(&self)
pub fn record_probe_success(&self)
Record a successful active probe (a 2xx within the timeout). Promotes a pessimistic / ejected
instance once it reaches its threshold — one success the first time ever, healthy_threshold
after a later eject — and resets the consecutive-failure streak.
Sourcepub fn record_probe_failure(&self)
pub fn record_probe_failure(&self)
Record a failed active probe (non-2xx, timeout, or connect error).
Sourcepub fn record_passive_failure(&self)
pub fn record_passive_failure(&self)
Record a passive failure — a real forwarded request that could not even connect to this instance (ADR 000017). It demotes exactly like a probe failure, but can only ever demote: an ejected instance receives no traffic, so only the active prober restores it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pick
impl RefUnwindSafe for Pick
impl Send for Pick
impl Sync for Pick
impl Unpin for Pick
impl UnsafeUnpin for Pick
impl UnwindSafe for Pick
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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