pub struct HealthCheck {
pub name: String,
pub is_liveness: bool,
pub is_readiness: bool,
pub timeout: Duration,
/* private fields */
}Expand description
A health check definition.
Fields§
§name: StringCheck name.
is_liveness: boolWhether this is a liveness check.
is_readiness: boolWhether this is a readiness check.
timeout: DurationTimeout for check execution.
Implementations§
Source§impl HealthCheck
impl HealthCheck
Sourcepub fn new(
name: impl Into<String>,
check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Sync + Send>,
) -> HealthCheck
pub fn new( name: impl Into<String>, check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Sync + Send>, ) -> HealthCheck
Create a new health check.
Sourcepub fn liveness(self) -> HealthCheck
pub fn liveness(self) -> HealthCheck
Mark as liveness check.
Sourcepub fn readiness(self) -> HealthCheck
pub fn readiness(self) -> HealthCheck
Mark as readiness check.
Sourcepub fn timeout(self, timeout: Duration) -> HealthCheck
pub fn timeout(self, timeout: Duration) -> HealthCheck
Set timeout.
Sourcepub async fn check(&self) -> HealthCheckResult
pub async fn check(&self) -> HealthCheckResult
Execute the health check.
Sourcepub fn last_result(&self) -> Option<HealthCheckResult>
pub fn last_result(&self) -> Option<HealthCheckResult>
Get last check result.
Auto Trait Implementations§
impl !Freeze for HealthCheck
impl !RefUnwindSafe for HealthCheck
impl Send for HealthCheck
impl Sync for HealthCheck
impl Unpin for HealthCheck
impl !UnwindSafe for HealthCheck
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.