Skip to main content

FlowNode

Trait FlowNode 

Source
pub trait FlowNode<S: WorkflowState = State>: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 mut NodeContext<'life2, S>,
    ) -> Pin<Box<dyn Future<Output = Result<(), GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
👎Deprecated since 0.6.0:

Use LeafNode (read-only state + mutations) or ExecutorOperation (composite control) instead.

Expand description

向后兼容 — FlowNode trait。

已弃用。请使用 LeafNode(只读 State + emit Mutation)或 ExecutorOperation(组合节点,完整控制)。

FlowNode 接收 NodeContext(持有 &mut S),绕过了 Mutation 模式, 不利于 Checkpoint 和审计追踪。

§迁移指南

  • 如果节点只需读 State + 路由 → 迁移到 LeafNode
  • 如果节点需要直接写 State → 迁移到 LeafNode + ctx.record(mutation)
  • 如果节点是组合逻辑(Parallel、Subgraph)→ 迁移到 ExecutorOperation

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 mut NodeContext<'life2, S>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

👎Deprecated since 0.6.0:

Use LeafNode (read-only state + mutations) or ExecutorOperation (composite control) instead.

执行节点逻辑。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S: WorkflowState> FlowNode<S> for BarrierNode<S>

Source§

impl<S: WorkflowState> FlowNode<S> for ConditionNode<S>

ConditionNode 实现 FlowNode(向后兼容 — 使用 NodeContext)。

Source§

impl<S: WorkflowState> FlowNode<S> for TaskNode<S>

TaskNode 实现 FlowNode(向后兼容 — 使用 NodeContext)。

未来将迁移到 LeafNode + LeafContext。