Skip to main content

ResultGroup

Struct ResultGroup 

Source
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

Source

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.

Source

pub fn empty(group_id: TaskId) -> Self

Create an empty result group with no children yet registered.

Source

pub fn group_id(&self) -> TaskId

The group / chord identifier.

Source

pub fn child_ids(&self) -> &[TaskId] ⓘ

The child task ids in registration order.

Source

pub fn len(&self) -> usize

Number of registered children.

Source

pub fn is_empty(&self) -> bool

Returns true if no children are registered.

Source

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).

Source

pub fn add_child_with_result( &mut self, task_id: TaskId, result: TaskResultValue, )

Register an additional child together with its result.

Source

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.

Source

pub fn result_for(&self, task_id: TaskId) -> Option<&TaskResultValue>

Borrow the latest result for a specific child, if reported.

Source

pub fn children(&self) -> Vec<GroupChild>

Build a snapshot of all children (with their results) in order.

Source

pub fn reported_count(&self) -> usize

Number of children that have reported any result (terminal or not).

Source

pub fn completed_count(&self) -> usize

Number of children that have reached a terminal/ready state.

Source

pub fn successful_count(&self) -> usize

Number of children that succeeded.

Source

pub fn failed_count(&self) -> usize

Number of children that failed or were rejected.

Source

pub fn revoked_count(&self) -> usize

Number of children that were revoked.

Source

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).

Source

pub fn ready(&self) -> bool

Returns true if all registered children are terminal (ready).

An empty group is trivially ready.

Source

pub fn successful(&self) -> bool

Returns true if the group is ready and every child succeeded.

Source

pub fn failed(&self) -> bool

Returns true if the group is ready and at least one child did not succeed (failed, revoked, or rejected).

Source

pub fn status(&self) -> GroupStatus

Compute the aggregate GroupStatus (readiness + success/failure rollup).

Source

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.

Source

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 None if the group is not yet ready or any child did not produce a success value — mirroring the semantics of a chord header, which only fires when all members succeed.
Source

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.

Source

pub fn error_messages(&self) -> Vec<String>

Collect the error messages of all non-successful children, in registration order.

Trait Implementations§

Source§

impl Clone for ResultGroup

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResultGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more