pub enum GraphEvent {
NodeStart {
node_name: String,
span_id: SpanId,
step: usize,
},
NodeEnd {
node_name: String,
span_id: SpanId,
success: bool,
duration: Duration,
},
Node {
span_id: SpanId,
node_name: String,
event: NodeEvent,
},
BarrierWaiting {
barrier_id: BarrierId,
node_name: String,
span_id: SpanId,
},
BarrierResolved {
barrier_id: BarrierId,
decision: BarrierDecision,
},
ObservedError {
error: ObservedError,
node_name: String,
},
GraphComplete {
result: GraphResult,
},
GraphError {
error: GraphError,
state: State,
},
}Expand description
Graph 层流式事件 — 封闭、强类型、exhaustive match。
事件流生命周期:
- 正常结束:
GraphComplete恰好一次,然后 channel 关闭 - 异常结束:
GraphError恰好一次,然后 channel 关闭 - 终态事件后不再发送任何事件
Variants§
NodeStart
节点开始执行
NodeEnd
节点执行完成
Node
节点内部事件(通过 NodeEvent 中间层)
BarrierWaiting
Barrier 暂停 — 等待外部审批信号。
⚠️ 必须处理 — 如果不发送决策,Graph 执行将永久阻塞。
BarrierResolved
Barrier 决策已应用
ObservedError
观测错误 — 不影响 control flow
GraphComplete
Graph 执行完成(恰好一次)
GraphResult 即为终态的终极真理之源——内含 state、execution_log、duration。
不再在外层冗余携带 state。
Fields
§
result: GraphResultGraphError
Graph 执行出错(恰好一次)
携带出错瞬间的 state 快照,便于诊断。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphEvent
impl !UnwindSafe for GraphEvent
impl Freeze for GraphEvent
impl Send for GraphEvent
impl Sync for GraphEvent
impl Unpin for GraphEvent
impl UnsafeUnpin for GraphEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more