pub struct Health { /* private fields */ }Expand description
Shared readiness flag, flipped on once the process is wired up and flipped off as shutdown begins.
Implementations§
Source§impl Health
impl Health
Sourcepub fn set_ready(&self, ready: bool)
pub fn set_ready(&self, ready: bool)
Set readiness; /readyz returns 200 only while true AND the
process is not draining (see Health::is_draining).
Sourcepub fn with_on_drain(self, hook: Arc<dyn Fn() + Send + Sync>) -> Self
pub fn with_on_drain(self, hook: Arc<dyn Fn() + Send + Sync>) -> Self
Install a hook /drain fires once, the first time it’s hit — never
on a repeat call, so a lifecycle-hook retry or a human re-curling
/drain doesn’t repeat binary-specific side effects (e.g. don’t
flip a gRPC health check twice). Builder-style.
Sourcepub const fn with_drain_propagation_delay(self, delay: Duration) -> Self
pub const fn with_drain_propagation_delay(self, delay: Duration) -> Self
Override the delay drain sleeps before responding (production
default: DEFAULT_DRAIN_PROPAGATION_DELAY, 5s). Tests set this to
Duration::ZERO to keep the delay out of the critical path.
Builder-style.
Sourcepub fn is_draining(&self) -> bool
pub fn is_draining(&self) -> bool
true once /drain has been hit at least once.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Health
impl !UnwindSafe for Health
impl Freeze for Health
impl Send for Health
impl Sync for Health
impl Unpin for Health
impl UnsafeUnpin for Health
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
Mutably borrows from an owned value. Read more
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,
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> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request