kegani 0.1.1

A developer-friendly, ergonomic, production-ready Rust web framework
Documentation
//! Health check module for Kegani
//!
//! Provides liveness and readiness probes for Kubernetes and load balancers.

pub mod probe;

pub use probe::{HealthCheck, liveness_handler, readiness_handler};

/// Health status
#[derive(Debug, Clone)]
pub enum HealthStatus {
    Healthy,
    Unhealthy(String),
}

/// Health check result
#[derive(Debug, Clone)]
pub struct HealthReport {
    pub status: HealthStatus,
    pub checks: Vec<CheckResult>,
}

#[derive(Debug, Clone)]
pub struct CheckResult {
    pub name: String,
    pub healthy: bool,
    pub message: Option<String>,
}

impl HealthReport {
    /// Create a healthy report
    pub fn healthy() -> Self {
        Self {
            status: HealthStatus::Healthy,
            checks: vec![],
        }
    }

    /// Create an unhealthy report
    pub fn unhealthy(reason: &str) -> Self {
        Self {
            status: HealthStatus::Unhealthy(reason.to_string()),
            checks: vec![],
        }
    }
}