pub struct PauseCheckpoint {
pub workflow_id: String,
pub step_index: usize,
pub completed_steps: Vec<String>,
pub pending_steps: Vec<String>,
pub state_data: HashMap<String, String>,
pub paused_at: u64,
pub pause_reason: String,
}Expand description
A snapshot of workflow state recorded when the workflow is paused.
Fields§
§workflow_id: StringIdentifier of the paused workflow.
step_index: usizeZero-based index of the step at which execution was paused.
completed_steps: Vec<String>Names of steps that had already completed before pausing.
pending_steps: Vec<String>Names of steps still remaining to be executed.
state_data: HashMap<String, String>Arbitrary serialised outputs or metadata from completed steps.
paused_at: u64Unix timestamp (milliseconds) when the checkpoint was recorded.
pause_reason: StringHuman-readable reason the workflow was paused.
Implementations§
Source§impl PauseCheckpoint
impl PauseCheckpoint
Sourcepub fn new(workflow_id: impl Into<String>, step_index: usize) -> Self
pub fn new(workflow_id: impl Into<String>, step_index: usize) -> Self
Create a new checkpoint for workflow_id paused at step_index.
paused_at is set to the current wall-clock time in milliseconds.
Sourcepub fn with_completed(self, step: impl Into<String>) -> Self
pub fn with_completed(self, step: impl Into<String>) -> Self
Add a completed step name (builder pattern).
Sourcepub fn with_pending(self, step: impl Into<String>) -> Self
pub fn with_pending(self, step: impl Into<String>) -> Self
Add a pending step name (builder pattern).
Sourcepub fn with_state(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_state( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Insert a key-value pair into the state data (builder pattern).
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
Set the human-readable pause reason (builder pattern).
Sourcepub fn remaining_steps(&self) -> usize
pub fn remaining_steps(&self) -> usize
Number of steps still pending (not yet executed).
Sourcepub fn progress_percent(&self) -> f32
pub fn progress_percent(&self) -> f32
Progress as a fraction in [0.0, 1.0].
Returns 0.0 when no steps have been completed and no steps are pending.
Trait Implementations§
Source§impl Clone for PauseCheckpoint
impl Clone for PauseCheckpoint
Source§fn clone(&self) -> PauseCheckpoint
fn clone(&self) -> PauseCheckpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more