pub struct ResultGroup { /* private fields */ }Expand description
An aggregated set of child task results for a group or chord header.
The group preserves child registration order so that
ResultGroup::collected_values and ResultGroup::results return
values in a deterministic, caller-meaningful order.
Implementations§
Source§impl ResultGroup
impl ResultGroup
Sourcepub fn new(group_id: TaskId, children: Vec<TaskId>) -> Self
pub fn new(group_id: TaskId, children: Vec<TaskId>) -> Self
Create a new result group for group_id with the given child task ids,
in order. Duplicate ids are de-duplicated while preserving the first
occurrence’s position.
Sourcepub fn empty(group_id: TaskId) -> Self
pub fn empty(group_id: TaskId) -> Self
Create an empty result group with no children yet registered.
Sourcepub fn add_child(&mut self, task_id: TaskId)
pub fn add_child(&mut self, task_id: TaskId)
Register an additional child task id, appended to the end of the order.
No-op if the child is already registered (order is preserved).
Sourcepub fn add_child_with_result(
&mut self,
task_id: TaskId,
result: TaskResultValue,
)
pub fn add_child_with_result( &mut self, task_id: TaskId, result: TaskResultValue, )
Register an additional child together with its result.
Sourcepub fn set_result(&mut self, task_id: TaskId, result: TaskResultValue)
pub fn set_result(&mut self, task_id: TaskId, result: TaskResultValue)
Set (or replace) the latest result for a child.
If the child was not previously registered it is appended to the ordering so its value still participates in collection.
Sourcepub fn result_for(&self, task_id: TaskId) -> Option<&TaskResultValue>
pub fn result_for(&self, task_id: TaskId) -> Option<&TaskResultValue>
Borrow the latest result for a specific child, if reported.
Sourcepub fn children(&self) -> Vec<GroupChild>
pub fn children(&self) -> Vec<GroupChild>
Build a snapshot of all children (with their results) in order.
Sourcepub fn reported_count(&self) -> usize
pub fn reported_count(&self) -> usize
Number of children that have reported any result (terminal or not).
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Number of children that have reached a terminal/ready state.
Sourcepub fn successful_count(&self) -> usize
pub fn successful_count(&self) -> usize
Number of children that succeeded.
Sourcepub fn failed_count(&self) -> usize
pub fn failed_count(&self) -> usize
Number of children that failed or were rejected.
Sourcepub fn revoked_count(&self) -> usize
pub fn revoked_count(&self) -> usize
Number of children that were revoked.
Sourcepub fn completion_ratio(&self) -> f64
pub fn completion_ratio(&self) -> f64
Fraction of children that are complete, in [0.0, 1.0].
An empty group is considered fully complete (1.0).
Sourcepub fn ready(&self) -> bool
pub fn ready(&self) -> bool
Returns true if all registered children are terminal (ready).
An empty group is trivially ready.
Sourcepub fn successful(&self) -> bool
pub fn successful(&self) -> bool
Returns true if the group is ready and every child succeeded.
Sourcepub fn failed(&self) -> bool
pub fn failed(&self) -> bool
Returns true if the group is ready and at least one child did not
succeed (failed, revoked, or rejected).
Sourcepub fn status(&self) -> GroupStatus
pub fn status(&self) -> GroupStatus
Compute the aggregate GroupStatus (readiness + success/failure
rollup).
Sourcepub fn results(&self) -> Vec<Option<TaskResultValue>>
pub fn results(&self) -> Vec<Option<TaskResultValue>>
The ordered list of latest results, one entry per registered child in
registration order. Children that have not reported are None.
Sourcepub fn collected_values(&self) -> Option<Vec<Value>>
pub fn collected_values(&self) -> Option<Vec<Value>>
The ordered collected success values.
- Returns
Some(values)(in registration order) only if the group is ready and every child succeeded. - Returns
Noneif the group is not yet ready or any child did not produce a success value — mirroring the semantics of achordheader, which only fires when all members succeed.
Sourcepub fn successful_values(&self) -> Vec<Value>
pub fn successful_values(&self) -> Vec<Value>
Collect the success values of the children that did succeed, ignoring
the rest, in registration order. Unlike Self::collected_values this
never returns None and is useful for partial / best-effort rollups.
Sourcepub fn error_messages(&self) -> Vec<String>
pub fn error_messages(&self) -> Vec<String>
Collect the error messages of all non-successful children, in registration order.