pub struct WorkflowState { /* private fields */ }Expand description
Materialized view over the task-lifecycle log.
Serialize / Deserialize are derived so the state can be
snapshotted via CortexAdapter::snapshot
(the plan’s per-chain checkpoint that bounds failover replay) and
restored via open_from_snapshot.
Implementations§
Source§impl WorkflowState
impl WorkflowState
Sourcepub fn get(&self, id: TaskId) -> Option<TaskState>
pub fn get(&self, id: TaskId) -> Option<TaskState>
Look up a task’s state by id (TaskState is Copy).
Sourcepub fn all(&self) -> impl Iterator<Item = (TaskId, TaskState)> + '_
pub fn all(&self) -> impl Iterator<Item = (TaskId, TaskState)> + '_
Iterate over every live (id, state).
Sourcepub fn in_status(&self, status: TaskStatus) -> impl Iterator<Item = TaskId> + '_
pub fn in_status(&self, status: TaskStatus) -> impl Iterator<Item = TaskId> + '_
Iterate over the ids of tasks currently in status — the
scheduler’s “what’s runnable / waiting / blocked” read.
Sourcepub fn is_cancel_requested(&self, id: TaskId) -> bool
pub fn is_cancel_requested(&self, id: TaskId) -> bool
Has cancellation been requested for id? The single-writer
worker polls this and drives the task to a terminal status.
Sourcepub fn cancel_requested_count(&self) -> usize
pub fn cancel_requested_count(&self) -> usize
Number of tasks with a pending cancel request.
Sourcepub fn children_of(&self, id: TaskId) -> &[TaskId] ⓘ
pub fn children_of(&self, id: TaskId) -> &[TaskId] ⓘ
Direct children (shards / spawned children) of id.
Sourcepub fn parent_of(&self, id: TaskId) -> Option<TaskId>
pub fn parent_of(&self, id: TaskId) -> Option<TaskId>
The parent of id, if it was linked under one.
Sourcepub fn descendants(&self, id: TaskId) -> Vec<TaskId> ⓘ
pub fn descendants(&self, id: TaskId) -> Vec<TaskId> ⓘ
Every transitive descendant of id (children, grandchildren,
…), excluding id itself. The set a delete cascades over; the
caller also uses it to prune triggers waiting on the subtree.
Deterministic order (BFS).
Sourcepub fn subtree(&self, id: TaskId) -> Vec<TaskId> ⓘ
pub fn subtree(&self, id: TaskId) -> Vec<TaskId> ⓘ
id plus all its descendants — the full subtree a delete removes.
Sourcepub fn status_counts(&self) -> StatusCounts
pub fn status_counts(&self) -> StatusCounts
Roll-up of task counts per status (observability summary).
Trait Implementations§
Source§impl Clone for WorkflowState
impl Clone for WorkflowState
Source§fn clone(&self) -> WorkflowState
fn clone(&self) -> WorkflowState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkflowState
impl Debug for WorkflowState
Source§impl Default for WorkflowState
impl Default for WorkflowState
Source§fn default() -> WorkflowState
fn default() -> WorkflowState
Source§impl<'de> Deserialize<'de> for WorkflowState
impl<'de> Deserialize<'de> for WorkflowState
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>,
Source§impl RedexFold<WorkflowState> for WorkflowFold
impl RedexFold<WorkflowState> for WorkflowFold
Source§fn apply(
&mut self,
ev: &RedexEvent,
state: &mut WorkflowState,
) -> Result<(), RedexError>
fn apply( &mut self, ev: &RedexEvent, state: &mut WorkflowState, ) -> Result<(), RedexError>
state. Return an error to stop the fold.