Skip to main content

nodedb_cluster/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, ClusterError>;
4
5#[derive(Debug, Error)]
6pub enum ClusterError {
7    #[error("raft error: {0}")]
8    Raft(#[from] nodedb_raft::RaftError),
9
10    #[error("vshard {vshard_id} not mapped to any raft group")]
11    VShardNotMapped { vshard_id: u16 },
12
13    #[error("raft group {group_id} not found on this node")]
14    GroupNotFound { group_id: u64 },
15
16    #[error("migration in progress for vshard {vshard_id}")]
17    MigrationInProgress { vshard_id: u16 },
18
19    #[error("migration refused: estimated pause {estimated_us}µs exceeds budget {budget_us}µs")]
20    MigrationPauseBudgetExceeded { estimated_us: u64, budget_us: u64 },
21
22    #[error("node {node_id} not reachable")]
23    NodeUnreachable { node_id: u64 },
24
25    #[error("ghost stub not found: node={node_id} on shard={shard_id}")]
26    GhostNotFound { node_id: String, shard_id: u16 },
27
28    #[error("transport error: {detail}")]
29    Transport { detail: String },
30
31    #[error("storage error: {detail}")]
32    Storage { detail: String },
33
34    #[error("codec error: {detail}")]
35    Codec { detail: String },
36
37    #[error("circuit open for node {node_id}: peer has {failures} consecutive failures")]
38    CircuitOpen { node_id: u64, failures: u32 },
39
40    #[error("raft group {group_id} disappeared while waiting for conf change commit")]
41    JoinGroupDisappeared { group_id: u64 },
42
43    #[error("conf change commit timeout on group {group_id} (waited for index {log_index})")]
44    JoinCommitTimeout { group_id: u64, log_index: u64 },
45}