godark 0.2.0

Rust SDK for GoDark DEX — encrypted trading over WebSocket
Documentation
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PrecomputeSignal {
    #[prost(enumeration = "SignalState", tag = "1")]
    pub state: i32,
    #[prost(uint32, tag = "2")]
    pub triples: u32,
    #[prost(uint32, tag = "3")]
    pub bits: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SymbolFanout {
    #[prost(uint32, tag = "1")]
    pub symbol_id: u32,
    #[prost(enumeration = "SignalState", tag = "2")]
    pub state: i32,
    #[prost(uint32, tag = "3")]
    pub consecutive_failures: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FanoutSignal {
    #[prost(message, repeated, tag = "1")]
    pub symbols: ::prost::alloc::vec::Vec<SymbolFanout>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OracleSignal {
    #[prost(bool, tag = "1")]
    pub healthy: bool,
    #[prost(uint32, tag = "2")]
    pub symbol_id: u32,
    #[prost(uint64, tag = "3")]
    pub staleness_ms: u64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransportSignal {
    #[prost(uint32, tag = "1")]
    pub connected_peers: u32,
    #[prost(uint32, tag = "2")]
    pub required_peers: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BackendSignal {
    #[prost(bool, tag = "1")]
    pub database_ok: bool,
    #[prost(bool, tag = "2")]
    pub redis_ok: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FleetSignal {
    #[prost(uint32, tag = "1")]
    pub instances_total: u32,
    #[prost(uint32, tag = "2")]
    pub instances_stale: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SymbolCapacity {
    #[prost(uint32, tag = "1")]
    pub symbol_id: u32,
    #[prost(uint32, tag = "2")]
    pub nodes_ready: u32,
    #[prost(uint32, tag = "3")]
    pub nodes_total: u32,
    #[prost(bool, tag = "4")]
    pub admission_open: bool,
    #[prost(uint32, tag = "5")]
    pub max_in_flight: u32,
    #[prost(uint32, tag = "6")]
    pub effective_ceiling: u32,
    #[prost(uint32, tag = "7")]
    pub total_outstanding: u32,
    #[prost(uint32, tag = "8")]
    pub admit_headroom: u32,
    /// Oracle freshness for this symbol (edge risk-increasing admission).
    #[prost(bool, tag = "9")]
    pub oracle_healthy: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapacitySignal {
    #[prost(message, repeated, tag = "1")]
    pub symbols: ::prost::alloc::vec::Vec<SymbolCapacity>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HealthSignals {
    #[prost(message, optional, tag = "1")]
    pub precompute: ::core::option::Option<PrecomputeSignal>,
    #[prost(message, optional, tag = "2")]
    pub fanout: ::core::option::Option<FanoutSignal>,
    #[prost(message, optional, tag = "3")]
    pub oracle: ::core::option::Option<OracleSignal>,
    #[prost(message, optional, tag = "4")]
    pub transport: ::core::option::Option<TransportSignal>,
    #[prost(message, optional, tag = "5")]
    pub backend: ::core::option::Option<BackendSignal>,
    #[prost(message, optional, tag = "6")]
    pub fleet: ::core::option::Option<FleetSignal>,
    #[prost(message, optional, tag = "7")]
    pub capacity: ::core::option::Option<CapacitySignal>,
}
/// Unified health report published at /health and pushed over QUIC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HealthReport {
    #[prost(enumeration = "HealthRole", tag = "1")]
    pub role: i32,
    #[prost(string, tag = "2")]
    pub component_id: ::prost::alloc::string::String,
    #[prost(enumeration = "HealthState", tag = "3")]
    pub state: i32,
    #[prost(bool, tag = "4")]
    pub serving: bool,
    #[prost(message, optional, tag = "5")]
    pub signals: ::core::option::Option<HealthSignals>,
    #[prost(string, tag = "6")]
    pub cause: ::prost::alloc::string::String,
    #[prost(uint64, tag = "7")]
    pub updated_at_nanos: u64,
    #[prost(uint64, tag = "8")]
    pub sequence: u64,
    #[prost(uint32, tag = "9")]
    pub schema_version: u32,
}
/// Which GDX role produced a HealthReport.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum HealthRole {
    Unspecified = 0,
    TradingNode = 1,
    Sequencer = 2,
    Edge = 3,
    Orchestrator = 4,
}
impl HealthRole {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "HEALTH_ROLE_UNSPECIFIED",
            Self::TradingNode => "HEALTH_ROLE_TRADING_NODE",
            Self::Sequencer => "HEALTH_ROLE_SEQUENCER",
            Self::Edge => "HEALTH_ROLE_EDGE",
            Self::Orchestrator => "HEALTH_ROLE_ORCHESTRATOR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "HEALTH_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
            "HEALTH_ROLE_TRADING_NODE" => Some(Self::TradingNode),
            "HEALTH_ROLE_SEQUENCER" => Some(Self::Sequencer),
            "HEALTH_ROLE_EDGE" => Some(Self::Edge),
            "HEALTH_ROLE_ORCHESTRATOR" => Some(Self::Orchestrator),
            _ => None,
        }
    }
}
/// Normalized lifecycle state (strictest active signal wins).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum HealthState {
    Unspecified = 0,
    Waiting = 1,
    Bootstrapping = 2,
    Warming = 3,
    Ready = 4,
    Degraded = 5,
    NotServing = 6,
    Draining = 7,
}
impl HealthState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "HEALTH_STATE_UNSPECIFIED",
            Self::Waiting => "HEALTH_STATE_WAITING",
            Self::Bootstrapping => "HEALTH_STATE_BOOTSTRAPPING",
            Self::Warming => "HEALTH_STATE_WARMING",
            Self::Ready => "HEALTH_STATE_READY",
            Self::Degraded => "HEALTH_STATE_DEGRADED",
            Self::NotServing => "HEALTH_STATE_NOT_SERVING",
            Self::Draining => "HEALTH_STATE_DRAINING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "HEALTH_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "HEALTH_STATE_WAITING" => Some(Self::Waiting),
            "HEALTH_STATE_BOOTSTRAPPING" => Some(Self::Bootstrapping),
            "HEALTH_STATE_WARMING" => Some(Self::Warming),
            "HEALTH_STATE_READY" => Some(Self::Ready),
            "HEALTH_STATE_DEGRADED" => Some(Self::Degraded),
            "HEALTH_STATE_NOT_SERVING" => Some(Self::NotServing),
            "HEALTH_STATE_DRAINING" => Some(Self::Draining),
            _ => None,
        }
    }
}
/// Neutral signal state used inside role-adaptive signal payloads.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SignalState {
    Unspecified = 0,
    Waiting = 1,
    Bootstrapping = 2,
    Warming = 3,
    Ready = 4,
    Degraded = 5,
    NotServing = 6,
    Draining = 7,
}
impl SignalState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "SIGNAL_STATE_UNSPECIFIED",
            Self::Waiting => "SIGNAL_STATE_WAITING",
            Self::Bootstrapping => "SIGNAL_STATE_BOOTSTRAPPING",
            Self::Warming => "SIGNAL_STATE_WARMING",
            Self::Ready => "SIGNAL_STATE_READY",
            Self::Degraded => "SIGNAL_STATE_DEGRADED",
            Self::NotServing => "SIGNAL_STATE_NOT_SERVING",
            Self::Draining => "SIGNAL_STATE_DRAINING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SIGNAL_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "SIGNAL_STATE_WAITING" => Some(Self::Waiting),
            "SIGNAL_STATE_BOOTSTRAPPING" => Some(Self::Bootstrapping),
            "SIGNAL_STATE_WARMING" => Some(Self::Warming),
            "SIGNAL_STATE_READY" => Some(Self::Ready),
            "SIGNAL_STATE_DEGRADED" => Some(Self::Degraded),
            "SIGNAL_STATE_NOT_SERVING" => Some(Self::NotServing),
            "SIGNAL_STATE_DRAINING" => Some(Self::Draining),
            _ => None,
        }
    }
}