#[derive(Debug, Clone, PartialEq, Eq)]
#[repr(u8)]
pub enum ClientStatus {
Connecting,
Connected(ConnectionType),
Stalled,
Disconnected(DisconnectionType),
}
impl std::fmt::Display for ClientStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ClientStatus::Connecting => write!(f, "CONNECTING"),
ClientStatus::Connected(connection_type) => match connection_type {
ConnectionType::HttpPolling => write!(f, "CONNECTED:HTTP-POLLING"),
ConnectionType::HttpStreaming => write!(f, "CONNECTED:HTTP-STREAMING"),
ConnectionType::StreamSensing => write!(f, "CONNECTED:STREAM-SENSING"),
ConnectionType::WsPolling => write!(f, "CONNECTED:WS-POLLING"),
ConnectionType::WsStreaming => write!(f, "CONNECTED:WS-STREAMING"),
},
ClientStatus::Stalled => write!(f, "STALLED"),
ClientStatus::Disconnected(disconnection_type) => match disconnection_type {
DisconnectionType::WillRetry => write!(f, "DISCONNECTED:WILL-RETRY"),
DisconnectionType::TryingRecovery => write!(f, "DISCONNECTED:TRYING-RECOVERY"),
},
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum ConnectionType {
HttpPolling,
HttpStreaming,
StreamSensing,
WsPolling,
WsStreaming,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum DisconnectionType {
WillRetry,
TryingRecovery,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
#[repr(u8)]
pub enum LogType {
#[default]
StdLogs = 0,
TracingLogs = 1,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum Transport {
Ws,
Http,
WsStreaming,
HttpStreaming,
WsPolling,
HttpPolling,
}