pub struct ReadOnlyFallback(/* private fields */);Expand description
Shared handle to a WritablePolicy::Prefer pool’s fallback state. See Self::on_connect
and Self::on_acquire for the decisions it drives.
Implementations§
Source§impl ReadOnlyFallback
impl ReadOnlyFallback
pub fn new() -> ReadOnlyFallback
Sourcepub fn on_connect(&self, read_only: bool, now: Instant) -> bool
pub fn on_connect(&self, read_only: bool, now: Instant) -> bool
after_connect decision for a freshly opened connection: accept it? A writable
connection always clears the streak and is accepted. A read-only connection starts the
streak (if none is running) and is rejected until now - streak_start >= FALLBACK_AFTER.
Sourcepub fn on_acquire(&self, read_only: bool, now: Instant) -> bool
pub fn on_acquire(&self, read_only: bool, now: Instant) -> bool
before_acquire decision for a pooled connection: keep it? A writable connection clears
the streak (the same as Self::on_connect) and is kept. A read-only connection is
evicted immediately if no fallback streak is running (a writable connect has succeeded
since the fallback, so this connection is stale) or if the streak hasn’t reached
FALLBACK_AFTER yet (a connection turned read-only mid-pool, but we haven’t actually
fallen back – on_connect’s window check doesn’t cover already-pooled connections, so
this is the only place that can reject them). Once the window has elapsed, it’s evicted
at most once per PROBE_INTERVAL, as a re-probe, and kept in between.
Trait Implementations§
Source§impl Clone for ReadOnlyFallback
impl Clone for ReadOnlyFallback
Source§fn clone(&self) -> ReadOnlyFallback
fn clone(&self) -> ReadOnlyFallback
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReadOnlyFallback
impl Debug for ReadOnlyFallback
Source§impl Default for ReadOnlyFallback
impl Default for ReadOnlyFallback
Source§fn default() -> ReadOnlyFallback
fn default() -> ReadOnlyFallback
Auto Trait Implementations§
impl Freeze for ReadOnlyFallback
impl RefUnwindSafe for ReadOnlyFallback
impl Send for ReadOnlyFallback
impl Sync for ReadOnlyFallback
impl Unpin for ReadOnlyFallback
impl UnsafeUnpin for ReadOnlyFallback
impl UnwindSafe for ReadOnlyFallback
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ⓘ
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].