kona_node_service/service/
mode.rs

1//! Contains enums that configure the mode for the node to operate in.
2
3/// The [`NodeMode`] enum represents the modes of operation for the [`RollupNodeService`].
4///
5/// [`RollupNodeService`]: crate::RollupNodeService
6#[derive(
7    Debug,
8    Default,
9    Clone,
10    Copy,
11    PartialEq,
12    Eq,
13    derive_more::Display,
14    derive_more::FromStr,
15    strum::EnumIter,
16)]
17pub enum NodeMode {
18    /// Validator mode.
19    #[display("Validator")]
20    #[default]
21    Validator,
22    /// Sequencer mode.
23    #[display("Sequencer")]
24    Sequencer,
25}
26
27impl NodeMode {
28    /// Returns `true` if [`Self`] is [`Self::Validator`].
29    pub const fn is_validator(&self) -> bool {
30        matches!(self, Self::Validator)
31    }
32
33    /// Returns `true` if [`Self`] is [`Self::Sequencer`].
34    pub const fn is_sequencer(&self) -> bool {
35        matches!(self, Self::Sequencer)
36    }
37}
38
39/// The [`InteropMode`] enum represents how the node works with interop.
40#[derive(Debug, derive_more::Display, Default, Clone, Copy, PartialEq, Eq)]
41pub enum InteropMode {
42    /// The node is in polled mode.
43    #[display("Polled")]
44    #[default]
45    Polled,
46    /// The node is in indexed mode.
47    #[display("Indexed")]
48    Indexed,
49}