use crate::{
RestartState, ServiceActivationState, ServiceHealth, ServiceRuntimeState, WatchdogState,
};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ServiceSnapshot {
pub name: String,
pub health: ServiceHealth,
pub dependencies: Vec<String>,
pub dependency_requirements: Vec<String>,
pub activation: ServiceActivationState,
pub enabled: bool,
pub configured: bool,
pub running: bool,
pub runtime_state: ServiceRuntimeState,
pub restart_state: RestartState,
pub restart_count: u64,
pub operator_required: bool,
pub quarantined: bool,
pub critical: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WatchdogSnapshot {
pub state: WatchdogState,
pub last_reconcile_at_ms: u64,
pub last_progress_at_ms: u64,
pub reconcile_sequence: u64,
pub stalled_for_ms: u64,
pub critical_services_healthy: bool,
pub enabled: bool,
pub stall_timeout_ms: u64,
}
impl WatchdogSnapshot {
pub fn is_healthy(&self) -> bool {
!self.enabled || self.state == WatchdogState::Healthy
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RestartExecutorSnapshot {
pub healthy: bool,
pub pending: u64,
pub queue_capacity: usize,
pub worker_count: usize,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SupervisorDiagnosis {
pub graph_valid: bool,
pub issues: Vec<String>,
pub services: Vec<ServiceSnapshot>,
pub watchdog: WatchdogSnapshot,
pub restart_executor: RestartExecutorSnapshot,
}