pub struct FanOutExecutor { /* private fields */ }Expand description
Manages multiple FanOutGroups and tracks their completion state.
This type is not an async runtime; it is a pure bookkeeping layer.
The caller is responsible for actually executing child tasks (e.g. via
a thread pool or Tokio task set) and calling mark_complete when each
one finishes.
Implementations§
Source§impl FanOutExecutor
impl FanOutExecutor
Sourcepub fn submit_group(&mut self, group: FanOutGroup)
pub fn submit_group(&mut self, group: FanOutGroup)
Register a new FanOutGroup.
If a group with the same parent_step already exists it is replaced
and all previous completion records for it are discarded.
Sourcepub fn mark_complete(&mut self, task_id: &str)
pub fn mark_complete(&mut self, task_id: &str)
Mark a child task as complete.
The executor looks up the group the task belongs to and records the completion there. Unknown task IDs are silently ignored.
Sourcepub fn is_merge_condition_met(&self, group_id: &str) -> bool
pub fn is_merge_condition_met(&self, group_id: &str) -> bool
Return true when the merge condition for the group identified by
group_id (i.e. parent_step) is satisfied.
Returns false for unknown groups.
Sourcepub fn completed_count(&self, group_id: &str) -> usize
pub fn completed_count(&self, group_id: &str) -> usize
Return the number of tasks that have completed in a group.
Returns 0 for unknown groups.
Sourcepub fn total_count(&self, group_id: &str) -> usize
pub fn total_count(&self, group_id: &str) -> usize
Return the total number of child tasks in a group.
Returns 0 for unknown groups.
Sourcepub fn group_count(&self) -> usize
pub fn group_count(&self) -> usize
Return the number of registered groups.
Sourcepub fn remove_group(&mut self, group_id: &str) -> Option<FanOutGroup>
pub fn remove_group(&mut self, group_id: &str) -> Option<FanOutGroup>
Remove a group and its task mappings, returning the group if present.