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
13	Degraded,
14
15	Stopped,
16
17	Error,
18
19	Starting,
20
21	ShuttingDown,
22}
23
24impl Enum {
25	pub fn IsOperational(&self) -> bool { matches!(self, Enum::Running | Enum::Degraded | Enum::Starting) }
26}