datum-cluster 0.10.1

Datum cluster membership over SWIM gossip
Documentation
use std::{io, time::Duration};

/// Result alias for `datum-cluster`.
pub type ClusterResult<T> = Result<T, ClusterError>;

/// Errors returned by `datum-cluster`.
#[derive(Debug, thiserror::Error)]
pub enum ClusterError {
    /// Invalid node configuration.
    #[error("invalid cluster config: {0}")]
    InvalidConfig(String),
    /// UDP transport failure.
    #[error("cluster UDP transport failed: {0}")]
    Io(#[from] io::Error),
    /// Public state or event feed failed.
    #[error("cluster feed failed: {0}")]
    Feed(String),
    /// The membership actor has stopped.
    #[error("cluster node is stopped")]
    Stopped,
    /// The private foca engine returned an error.
    #[error("cluster gossip failed: {0}")]
    Gossip(String),
    /// The request timed out.
    #[error("cluster request timed out after {0:?}")]
    Timeout(Duration),
}

impl From<datum::StreamError> for ClusterError {
    fn from(error: datum::StreamError) -> Self {
        Self::Feed(error.to_string())
    }
}