hopr_lib/
state.rs

1use std::hash::Hash;
2
3use crate::exports::transport::HoprTransportProcess;
4
5/// An enum representing the current state of the HOPR node
6#[atomic_enum::atomic_enum]
7#[derive(PartialEq, Eq)]
8pub enum HoprState {
9    Uninitialized = 0,
10    Initializing = 1,
11    Running = 2,
12    Terminated = 3,
13}
14
15impl std::fmt::Display for HoprState {
16    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17        write!(f, "{self:?}")
18    }
19}
20
21/// Long-running tasks that are spawned by the HOPR node.
22#[derive(Debug, Clone, PartialEq, Eq, Hash, strum::Display, strum::EnumCount)]
23pub enum HoprLibProcess {
24    #[strum(to_string = "transport: {0}")]
25    Transport(HoprTransportProcess),
26    #[cfg(feature = "session-server")]
27    #[strum(to_string = "session server providing the exit node session stream functionality")]
28    SessionServer,
29    #[strum(to_string = "ticket redemption queue driver")]
30    TicketRedemptions,
31    #[strum(to_string = "subscription for on-chain account announcements")]
32    AccountAnnouncements,
33    #[strum(to_string = "subscription for on-chain channel updates")]
34    ChannelEvents,
35    #[strum(to_string = "on received ticket event (winning or rejected)")]
36    TicketEvents,
37}