use super::{HealthCheck, HealthResult, HealthStatus};
use crate::error::GarrisonError;
pub struct AlwaysHealthy;
impl HealthCheck for AlwaysHealthy {
fn name(&self) -> &str {
"always-healthy"
}
fn check(
&self,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = HealthResult<HealthStatus>> + Send>>
{
Box::pin(async { Ok(HealthStatus::Healthy) })
}
}
pub struct AlwaysUnhealthy;
impl HealthCheck for AlwaysUnhealthy {
fn name(&self) -> &str {
"always-unhealthy"
}
fn check(
&self,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = HealthResult<HealthStatus>> + Send>>
{
Box::pin(async {
Err(GarrisonError::Internal(
"dependency unavailable".to_string(),
))
})
}
}
pub struct AlwaysDegraded;
impl HealthCheck for AlwaysDegraded {
fn name(&self) -> &str {
"always-degraded"
}
fn check(
&self,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = HealthResult<HealthStatus>> + Send>>
{
Box::pin(async { Ok(HealthStatus::Degraded) })
}
}