pub struct WorkflowSnapshot {
pub seq: SnapshotSeq,
pub workflow_id: String,
pub timestamp_secs: u64,
pub label: String,
pub tasks: Vec<TaskSnapshot>,
pub metadata: HashMap<String, String>,
}Expand description
An immutable snapshot of the entire workflow at a point in time.
Fields§
§seq: SnapshotSeqSequence number of this snapshot.
workflow_id: StringWorkflow identifier.
timestamp_secs: u64Wall-clock time the snapshot was taken (seconds since epoch).
label: StringLabel describing why this snapshot was taken.
tasks: Vec<TaskSnapshot>Per-task state snapshots.
metadata: HashMap<String, String>Arbitrary metadata attached to the snapshot.
Implementations§
Source§impl WorkflowSnapshot
impl WorkflowSnapshot
Sourcepub fn new(
seq: SnapshotSeq,
workflow_id: impl Into<String>,
timestamp_secs: u64,
label: impl Into<String>,
) -> Self
pub fn new( seq: SnapshotSeq, workflow_id: impl Into<String>, timestamp_secs: u64, label: impl Into<String>, ) -> Self
Create a new workflow snapshot.
Sourcepub fn add_task(&mut self, task: TaskSnapshot)
pub fn add_task(&mut self, task: TaskSnapshot)
Add a task snapshot.
Sourcepub fn set_metadata(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn set_metadata(&mut self, key: impl Into<String>, value: impl Into<String>)
Attach metadata.
Sourcepub fn task_count(&self) -> usize
pub fn task_count(&self) -> usize
Return the number of tasks in this snapshot.
Sourcepub fn count_in_state(&self, state: &CapturedTaskState) -> usize
pub fn count_in_state(&self, state: &CapturedTaskState) -> usize
Count tasks in a given state.
Sourcepub fn completion_ratio(&self) -> f64
pub fn completion_ratio(&self) -> f64
Return the completion ratio (0.0..=1.0).
Sourcepub fn find_task(&self, task_id: &str) -> Option<&TaskSnapshot>
pub fn find_task(&self, task_id: &str) -> Option<&TaskSnapshot>
Find a task snapshot by id.
Trait Implementations§
Source§impl Clone for WorkflowSnapshot
impl Clone for WorkflowSnapshot
Source§fn clone(&self) -> WorkflowSnapshot
fn clone(&self) -> WorkflowSnapshot
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 moreAuto Trait Implementations§
impl Freeze for WorkflowSnapshot
impl RefUnwindSafe for WorkflowSnapshot
impl Send for WorkflowSnapshot
impl Sync for WorkflowSnapshot
impl Unpin for WorkflowSnapshot
impl UnsafeUnpin for WorkflowSnapshot
impl UnwindSafe for WorkflowSnapshot
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