Skip to main content

Node

Trait Node 

Source
pub trait Node<S: GraphState>: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        state: &'life1 S,
        ctx: &'life2 NodeCtx<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<NodeOut<S>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided methods
    fn name(&self) -> &str { ... }
    fn retry_policy(&self) -> Option<NodeRetryPolicy> { ... }
}
Expand description

The unit of computation in a graph. Async, takes a &S snapshot of state

  • per-step context, returns a delta + a routing decision.

Required Methods§

Source

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

Execute one superstep of this node.

Provided Methods§

Source

fn name(&self) -> &str

Friendly name for telemetry / logging. Default uses the type name.

Source

fn retry_policy(&self) -> Option<NodeRetryPolicy>

Per-task retry policy. Default None means “no retry — propagate the error”. When Some, the engine retries execute on retryable errors with exponential backoff.

Implementors§

Source§

impl<P, C> Node<P> for Subgraph<P, C>
where P: GraphState + Send + Sync + 'static, C: GraphState + Clone + Send + Sync + 'static, <C as GraphState>::Update: Clone, <P as GraphState>::Update: Send + 'static,

Source§

impl<S, F, Fut> Node<S> for NodeFn<S, F>
where S: GraphState, F: Fn(&S, &NodeCtx<'_>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<NodeOut<S>>> + Send,

Source§

impl<S: GraphState> Node<S> for BarrierNode<S>
where S::Update: Default,