pub struct ExecutionContext {
pub execution_id: ExecutionId,
pub workflow_id: WorkflowId,
pub started_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
pub state: ExecutionState,
pub node_results: HashMap<NodeId, NodeExecutionResult>,
pub variables: HashMap<String, Value>,
pub checkpoint: Option<ExecutionCheckpoint>,
}Expand description
Context for workflow execution
Fields§
§execution_id: ExecutionIdUnique execution identifier
workflow_id: WorkflowIdThe workflow being executed
started_at: DateTime<Utc>When the execution started
completed_at: Option<DateTime<Utc>>When the execution completed (if finished)
state: ExecutionStateCurrent execution state
node_results: HashMap<NodeId, NodeExecutionResult>Node execution results
variables: HashMap<String, Value>Global variables/context available to all nodes
checkpoint: Option<ExecutionCheckpoint>Checkpoint data for resume capability
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
pub fn new(workflow_id: WorkflowId) -> Self
Sourcepub fn create_checkpoint(&mut self) -> ExecutionCheckpoint
pub fn create_checkpoint(&mut self) -> ExecutionCheckpoint
Create a checkpoint of the current execution state
Sourcepub fn resume_from_checkpoint(
checkpoint: ExecutionCheckpoint,
workflow_id: WorkflowId,
) -> Self
pub fn resume_from_checkpoint( checkpoint: ExecutionCheckpoint, workflow_id: WorkflowId, ) -> Self
Resume from a checkpoint
Sourcepub fn can_resume(&self) -> bool
pub fn can_resume(&self) -> bool
Check if execution can be resumed
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark execution as completed
Sourcepub fn record_node_result(
&mut self,
node_id: NodeId,
result: NodeExecutionResult,
)
pub fn record_node_result( &mut self, node_id: NodeId, result: NodeExecutionResult, )
Record the result of a node execution
Sourcepub fn get_node_result(&self, node_id: &NodeId) -> Option<&NodeExecutionResult>
pub fn get_node_result(&self, node_id: &NodeId) -> Option<&NodeExecutionResult>
Get the result of a previous node execution
Sourcepub fn set_variable(&mut self, key: String, value: Value)
pub fn set_variable(&mut self, key: String, value: Value)
Set a variable in the execution context
Sourcepub fn get_variable(&self, key: &str) -> Option<&Value>
pub fn get_variable(&self, key: &str) -> Option<&Value>
Get a variable from the execution context
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExecutionContext
impl Debug for ExecutionContext
Source§impl<'de> Deserialize<'de> for ExecutionContext
impl<'de> Deserialize<'de> for ExecutionContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ExecutionContext
impl RefUnwindSafe for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnwindSafe for ExecutionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more