Skip to main content

bpm_engine_core/
node.rs

1use std::collections::HashMap;
2
3pub type NodeId = &'static str;
4
5#[derive(Debug, Clone)]
6pub enum EdgeCondition {
7    VariableEq { key: String, value: String },
8    Expression(String),
9    Default,
10}
11
12#[derive(Debug, Clone)]
13pub struct OutgoingEdge {
14    pub target: NodeId,
15    pub condition: Option<EdgeCondition>,
16}
17
18#[derive(Debug, Clone)]
19pub enum NodeType {
20    Start,
21    End,
22    ServiceTask(fn(&mut super::instance::ProcessInstance)),
23    UserTask,
24    /// Pull-based external task: worker fetches, locks, completes/fails.
25    ExternalTask {
26        task_type: String,
27        retries: i32,
28        timeout_secs: u64,
29    },
30    ExclusiveGateway,
31    ParallelFork,
32    ParallelJoin {
33        expected: usize,
34    },
35}
36
37#[derive(Debug, Clone)]
38pub struct Node {
39    pub id: NodeId,
40    pub node_type: NodeType,
41    pub outgoing_edges: Vec<OutgoingEdge>,
42}
43
44#[derive(Debug, Clone)]
45pub struct ProcessDefinition {
46    pub id: &'static str,
47    pub nodes: HashMap<NodeId, Node>,
48    pub start: NodeId,
49}