1use crate::exports::transport::HoprTransportProcess;
2
3#[atomic_enum::atomic_enum]
5#[derive(PartialEq, Eq)]
6pub enum HoprState {
7 Uninitialized = 0,
8 Initializing = 1,
9 Indexing = 2,
10 Starting = 3,
11 Running = 4,
12}
13
14impl std::fmt::Display for HoprState {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 write!(f, "{self:?}")
17 }
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, Hash, strum::Display)]
25pub enum HoprLibProcesses {
26 #[strum(to_string = "transport: {0}")]
27 Transport(HoprTransportProcess),
28 #[cfg(feature = "session-server")]
29 #[strum(to_string = "session server providing the exit node session stream functionality")]
30 SessionServer,
31 #[strum(to_string = "tick wake up the strategies to perform an action")]
32 StrategyTick,
33 #[strum(to_string = "initial indexing operation into the DB")]
34 Indexing,
35 #[strum(to_string = "processing of indexed operations in internal components")]
36 IndexReflection,
37 #[strum(to_string = "on-chain transaction queue component for outgoing transactions")]
38 OutgoingOnchainActionQueue,
39 #[strum(to_string = "flush operation of outgoing ticket indices to the DB")]
40 TicketIndexFlush,
41 #[strum(to_string = "on received ack ticket trigger")]
42 OnReceivedAcknowledgement,
43}
44
45impl HoprLibProcesses {
46 pub fn can_finish(&self) -> bool {
49 matches!(self, HoprLibProcesses::Indexing)
50 }
51}
52
53impl From<HoprTransportProcess> for HoprLibProcesses {
54 fn from(value: HoprTransportProcess) -> Self {
55 HoprLibProcesses::Transport(value)
56 }
57}