1use std::{io, time::Duration};
2
3pub type ClusterResult<T> = Result<T, ClusterError>;
5
6#[derive(Debug, thiserror::Error)]
8pub enum ClusterError {
9 #[error("invalid cluster config: {0}")]
11 InvalidConfig(String),
12 #[error("cluster UDP transport failed: {0}")]
14 Io(#[from] io::Error),
15 #[error("cluster feed failed: {0}")]
17 Feed(String),
18 #[error("cluster node is stopped")]
20 Stopped,
21 #[error("cluster gossip failed: {0}")]
23 Gossip(String),
24 #[error("cluster request timed out after {0:?}")]
26 Timeout(Duration),
27}
28
29impl From<datum::StreamError> for ClusterError {
30 fn from(error: datum::StreamError) -> Self {
31 Self::Feed(error.to_string())
32 }
33}