use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::time::Timestamp; #[derive(Serialize, Deserialize, Clone)] pub struct Flow { /// Job Id set tby the actor which created it pub id: u32, /// Actor Id who created this job pub caller_id: u32, /// The context in which this job is executed pub context_id: u32, /// List of jobs which make up the flow pub jobs: Vec, /// Environment variables, passed to every job when executed pub env_vars: HashMap, /// The result of the flow pub result: HashMap, pub created_at: Timestamp, pub updated_at: Timestamp, pub status: FlowStatus, } /// The status of a flow #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] pub enum FlowStatus { Created, Dispatched, Started, Error, Finished, } impl Flow { pub fn id(&self) -> u32 { self.id } pub fn caller_id(&self) -> u32 { self.caller_id } pub fn context_id(&self) -> u32 { self.context_id } pub fn jobs(&self) -> &[u32] { &self.jobs } }