pub trait LongRunningNode<Context, Action>: Send + Syncwhere
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Debug,
Self::State: Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static,
Self::Output: Send + 'static,{
type State;
type Output;
// Required methods
fn process<'life0, 'life1, 'async_trait>(
&'life0 self,
state: Option<Self::State>,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<LongRunningOutcome<Self::Output, Self::State>, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn id(&self) -> NodeId;
}Expand description
Trait for nodes that handle long-running processes with checkpoints.
A LongRunningNode is capable of processing work incrementally, saving its state
between executions, and resuming from the last checkpoint.
Required Associated Types§
Required Methods§
Sourcefn process<'life0, 'life1, 'async_trait>(
&'life0 self,
state: Option<Self::State>,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<LongRunningOutcome<Self::Output, Self::State>, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn process<'life0, 'life1, 'async_trait>(
&'life0 self,
state: Option<Self::State>,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<LongRunningOutcome<Self::Output, Self::State>, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Process the next step, potentially suspending execution