1use std::fmt::{Display, Debug};
2
3
4#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
5pub enum SessionLivedBackendState {
6 Submitted,
8
9 Constructed,
11
12 Scheduled,
14
15 Running,
17
18 Ready,
20
21 Swept,
23
24 Failed,
26}
27
28impl Default for SessionLivedBackendState {
29 fn default() -> Self {
30 SessionLivedBackendState::Submitted
31 }
32}
33
34impl Display for SessionLivedBackendState {
35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 Debug::fmt(&self, f)
37 }
38}
39
40impl SessionLivedBackendState {
41 pub fn message(&self) -> String {
42 match self {
43 SessionLivedBackendState::Submitted => {
44 "SessionLivedBackend object created.".to_string()
45 }
46 SessionLivedBackendState::Constructed => {
47 "Backing resources created by Spawner.".to_string()
48 }
49 SessionLivedBackendState::Scheduled => {
50 "Backing pod was scheduled by Kubernetes.".to_string()
51 }
52 SessionLivedBackendState::Running => "Pod was observed running.".to_string(),
53 SessionLivedBackendState::Ready => {
54 "Pod was observed listening on TCP port.".to_string()
55 }
56 SessionLivedBackendState::Swept => {
57 "SessionLivedBackend was found idle and swept.".to_string()
58 }
59 &SessionLivedBackendState::Failed => {
60 "SessionLivedBackend failed.".to_string()
61 }
62 }
63 }
64}