laminar_core/dag/error.rs
1//! Error types for DAG topology operations.
2
3/// Errors that can occur during DAG construction and validation.
4#[derive(Debug, thiserror::Error)]
5pub enum DagError {
6 /// The DAG contains a cycle involving the named node.
7 #[error("cycle detected involving node: {0}")]
8 CycleDetected(String),
9
10 /// A node has no inputs and no outputs (and is not a source or sink).
11 #[error("disconnected node: {0}")]
12 DisconnectedNode(String),
13
14 /// An edge references a node that does not exist.
15 #[error("node not found: {0}")]
16 NodeNotFound(String),
17
18 /// A node with the same name already exists.
19 #[error("duplicate node name: {0}")]
20 DuplicateNode(String),
21
22 /// Connected edges have incompatible schemas.
23 #[error("schema mismatch between {source_node} and {target_node}: {reason}")]
24 SchemaMismatch {
25 /// Source node name.
26 source_node: String,
27 /// Target node name.
28 target_node: String,
29 /// Description of the incompatibility.
30 reason: String,
31 },
32
33 /// A node exceeds the maximum fan-out limit.
34 #[error("fan-out limit exceeded: node {node} has {count} outputs (max {max})")]
35 FanOutLimitExceeded {
36 /// Node name.
37 node: String,
38 /// Actual fan-out count.
39 count: usize,
40 /// Maximum allowed fan-out.
41 max: usize,
42 },
43
44 /// The DAG is empty (no nodes).
45 #[error("empty DAG: no nodes")]
46 EmptyDag,
47
48 /// A shared stage multicast buffer is full (backpressure).
49 #[error("backpressure: buffer full")]
50 BackpressureFull,
51
52 /// A checkpoint barrier was triggered while another checkpoint is in progress.
53 #[error("checkpoint already in progress: epoch {0}")]
54 CheckpointInProgress(u64),
55
56 /// Attempted to finalize a checkpoint when none is in progress.
57 #[error("no checkpoint in progress")]
58 NoCheckpointInProgress,
59
60 /// Attempted to finalize a checkpoint before all nodes have reported.
61 #[error("checkpoint incomplete: {pending} nodes still pending")]
62 CheckpointIncomplete {
63 /// Number of nodes that have not yet reported.
64 pending: usize,
65 },
66
67 /// No checkpoint snapshots are available for recovery.
68 #[error("no checkpoint snapshots available")]
69 CheckpointNotFound,
70
71 /// An operator failed to restore from a checkpoint snapshot.
72 #[error("restore failed for node '{node_id}': {reason}")]
73 RestoreFailed {
74 /// The node that failed to restore.
75 node_id: String,
76 /// Description of the failure.
77 reason: String,
78 },
79
80 /// A base table schema was not provided for DAG construction from `MvRegistry`.
81 #[error("base table schema not found: {0}")]
82 BaseTableSchemaNotFound(String),
83}