Struct ConnectionHealthWatcher
pub struct ConnectionHealthWatcher(/* private fields */);net only.Expand description
Watcher that can update and read the ConnectionHealth
Note: this should only be added once to extensions and be used by all connection / health checks.
§Install vs mark/read convention
A protocol implementation installing the watcher for a new logical
connection must use self_get_ref_or_insert (this extensions level only):
a transport forked off a consumed connection (e.g. a CONNECT tunnel from an
upgraded h1 hop) must not adopt that connection’s health state through the
parent chain. Marking and reading should use the walking
get_ref/get_ref_or_insert, so they resolve to the watcher governing the
connection at hand.
Whoever observes an event that makes a connection non-reusable (an abandoned mid-stream body, a cancelled in-flight request, a protocol error) must mark it broken synchronously with that event, before any guard releases the connection back to a pool: deferring the mark to a background connection task loses the race against the next request checking the connection out.
Implementations§
§impl ConnectionHealthWatcher
impl ConnectionHealthWatcher
pub fn new() -> ConnectionHealthWatcher
pub fn install(extensions: &Extensions) -> &ConnectionHealthWatcher
pub fn install(extensions: &Extensions) -> &ConnectionHealthWatcher
Install the watcher for a new logical connection.
Inserts at this extensions level only (no parent walk), per the
install-vs-mark convention above: use this from protocol handshakes,
and the walking get_ref/get_ref_or_insert to read or mark.
pub fn mark_healthy(&self)
pub fn mark_healthy(&self)
Set the ConnectionHealth to health
pub fn mark_broken(&self)
pub fn mark_broken(&self)
Set the ConnectionHealth to broken
pub fn update_health(&self, health: ConnectionHealth)
pub fn update_health(&self, health: ConnectionHealth)
Set the ConnectionHealth
pub fn health(&self) -> ConnectionHealth
pub fn health(&self) -> ConnectionHealth
Get the ConnectionHealth
pub fn watch(&self) -> Changed<ConnectionHealth>
pub fn watch(&self) -> Changed<ConnectionHealth>
Subscribe to health changes: Changed::changed yields each new value.
Trait Implementations§
§impl Debug for ConnectionHealthWatcher
impl Debug for ConnectionHealthWatcher
§impl Default for ConnectionHealthWatcher
impl Default for ConnectionHealthWatcher
§fn default() -> ConnectionHealthWatcher
fn default() -> ConnectionHealthWatcher
impl Extension for ConnectionHealthWatcher
impl NetExtension for ConnectionHealthWatcher
Auto Trait Implementations§
impl !Freeze for ConnectionHealthWatcher
impl RefUnwindSafe for ConnectionHealthWatcher
impl Send for ConnectionHealthWatcher
impl Sync for ConnectionHealthWatcher
impl Unpin for ConnectionHealthWatcher
impl UnsafeUnpin for ConnectionHealthWatcher
impl UnwindSafe for ConnectionHealthWatcher
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§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> ⓘ
§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§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 rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more