pub struct WorkflowCheckpoint {
pub workflow_id: String,
pub completed_steps: Vec<String>,
pub step_outputs: HashMap<String, Value>,
pub created_at: u64,
pub workflow_version: u32,
}Expand description
A snapshot of workflow execution state persisted to disk.
Fields§
§workflow_id: StringUnique identifier of the workflow this checkpoint belongs to.
completed_steps: Vec<String>Names of steps that had completed when this checkpoint was taken.
step_outputs: HashMap<String, Value>Arbitrary JSON outputs produced by each completed step, keyed by step name.
created_at: u64Unix timestamp (seconds) when the checkpoint was created.
workflow_version: u32Schema / content version of the workflow definition at checkpoint time.
Implementations§
Source§impl WorkflowCheckpoint
impl WorkflowCheckpoint
Sourcepub fn new(workflow_id: impl Into<String>, workflow_version: u32) -> Self
pub fn new(workflow_id: impl Into<String>, workflow_version: u32) -> Self
Creates a new checkpoint with the current wall-clock timestamp.
Sourcepub fn mark_step_completed(
&mut self,
step_name: impl Into<String>,
output: Option<Value>,
)
pub fn mark_step_completed( &mut self, step_name: impl Into<String>, output: Option<Value>, )
Marks a step as completed, optionally recording its output.
Sourcepub fn is_step_completed(&self, step_name: &str) -> bool
pub fn is_step_completed(&self, step_name: &str) -> bool
Returns true if the given step was already completed.
Sourcepub fn step_output(&self, step_name: &str) -> Option<&Value>
pub fn step_output(&self, step_name: &str) -> Option<&Value>
Returns the output for a completed step, if any was recorded.
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Returns the number of completed steps.
Trait Implementations§
Source§impl Clone for WorkflowCheckpoint
impl Clone for WorkflowCheckpoint
Source§fn clone(&self) -> WorkflowCheckpoint
fn clone(&self) -> WorkflowCheckpoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WorkflowCheckpoint
impl Debug for WorkflowCheckpoint
Source§impl<'de> Deserialize<'de> for WorkflowCheckpoint
impl<'de> Deserialize<'de> for WorkflowCheckpoint
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
Source§impl PartialEq for WorkflowCheckpoint
impl PartialEq for WorkflowCheckpoint
Source§impl Serialize for WorkflowCheckpoint
impl Serialize for WorkflowCheckpoint
impl StructuralPartialEq for WorkflowCheckpoint
Auto Trait Implementations§
impl Freeze for WorkflowCheckpoint
impl RefUnwindSafe for WorkflowCheckpoint
impl Send for WorkflowCheckpoint
impl Sync for WorkflowCheckpoint
impl Unpin for WorkflowCheckpoint
impl UnsafeUnpin for WorkflowCheckpoint
impl UnwindSafe for WorkflowCheckpoint
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