Struct HealthCheck
pub struct HealthCheck {
pub name: String,
check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Send + Sync>,
pub is_liveness: bool,
pub is_readiness: bool,
pub timeout: Duration,
last_result: RwLock<RawRwLock, Option<HealthCheckResult>>,
}Expand description
A health check definition.
Fields§
§name: StringCheck name.
check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Send + Sync>§is_liveness: boolWhether this is a liveness check.
is_readiness: boolWhether this is a readiness check.
timeout: DurationTimeout for check execution.
last_result: RwLock<RawRwLock, Option<HealthCheckResult>>Implementations§
§impl HealthCheck
impl HealthCheck
pub fn new(
name: impl Into<String>,
check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Send + Sync>,
) -> HealthCheck
pub fn new( name: impl Into<String>, check_fn: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = HealthStatus> + Send>> + Send + Sync>, ) -> HealthCheck
Create a new health check.
pub fn liveness(self) -> HealthCheck
pub fn liveness(self) -> HealthCheck
Mark as liveness check.
pub fn readiness(self) -> HealthCheck
pub fn readiness(self) -> HealthCheck
Mark as readiness check.
pub fn timeout(self, timeout: Duration) -> HealthCheck
pub fn timeout(self, timeout: Duration) -> HealthCheck
Set timeout.
pub async fn check(&self) -> HealthCheckResult
pub async fn check(&self) -> HealthCheckResult
Execute the health check.
pub 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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§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>
Converts
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>
Converts
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> LayoutRaw for T
impl<T> LayoutRaw for T
§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.