use serde::Serialize;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NodeStatus {
Pending,
Starting,
Running,
Healthy,
Failed {
reason: String,
},
Stopped,
}
impl NodeStatus {
#[must_use]
pub fn is_ready(&self) -> bool {
matches!(self, Self::Healthy | Self::Running)
}
#[must_use]
pub fn is_terminal(&self) -> bool {
matches!(self, Self::Failed { .. } | Self::Stopped)
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum LifecycleEvent {
ResourceStarted {
name: String,
container_id: String,
},
ResourceHealthy {
name: String,
},
ResourceFailed {
name: String,
error: String,
},
ResourceStopped {
name: String,
},
StackStarted,
StackStopping,
StackStopped,
}