Skip to main content

Mountain/IPC/Common/ServiceInfo/
ServiceState.rs

1#![allow(non_snake_case)]
2
3//! Lifecycle state of a service. `IsOperational` covers the three
4//! states a caller can still send work to (Running / Degraded /
5//! Starting); the rest are terminal or transitional.
6
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
10pub enum Enum {
11	Running,
12	Degraded,
13	Stopped,
14	Error,
15	Starting,
16	ShuttingDown,
17}
18
19impl Enum {
20	pub fn IsOperational(&self) -> bool { matches!(self, Enum::Running | Enum::Degraded | Enum::Starting) }
21}