Skip to main content

WorkflowEngineTrait

Trait WorkflowEngineTrait 

Source
pub trait WorkflowEngineTrait: Send + Sync {
    // Required methods
    fn add_node(&mut self, node: Node) -> Layer2Result<()>;
    fn add_edge(&mut self, from: &str, to: &str) -> Layer2Result<()>;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        input: WorkflowInput,
    ) -> Pin<Box<dyn Future<Output = Layer2Result<WorkflowOutput>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cancel<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task_id: &'life1 TaskId,
    ) -> Pin<Box<dyn Future<Output = Layer2Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn status(&self, task_id: &TaskId) -> Layer2Result<WorkflowStatus>;
    fn validate(&self) -> Layer2Result<Vec<String>>;
    fn node_count(&self) -> usize;
    fn edge_count(&self) -> usize;
}
Expand description

工作流引擎接口

Required Methods§

Source

fn add_node(&mut self, node: Node) -> Layer2Result<()>

添加节点

Source

fn add_edge(&mut self, from: &str, to: &str) -> Layer2Result<()>

添加边(依赖关系)

Source

fn execute<'life0, 'async_trait>( &'life0 self, input: WorkflowInput, ) -> Pin<Box<dyn Future<Output = Layer2Result<WorkflowOutput>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

执行工作流

Source

fn cancel<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Layer2Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

取消工作流

Source

fn status(&self, task_id: &TaskId) -> Layer2Result<WorkflowStatus>

获取工作流状态

Source

fn validate(&self) -> Layer2Result<Vec<String>>

验证 DAG 结构

Source

fn node_count(&self) -> usize

获取节点数量

Source

fn edge_count(&self) -> usize

获取边数量

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§