Skip to main content

OutcomeExt

Trait OutcomeExt 

Source
pub trait OutcomeExt<R>
where Self: Stream<Item = Outcome<R>> + Send + Sized, R: Send,
{ // Required methods fn merge<T, F>( self, init: T, merge: F, ) -> impl Future<Output = (T, Faults)> + Send where T: Send, F: Fn(T, R) -> T + Send; fn grid<K, I, F>(self, extract: F) -> impl Future<Output = Grid<K>> + Send where K: Ord + Send, I: IntoIterator<Item = K>, F: Fn(R) -> I + Send; fn tally(self) -> impl Future<Output = Tally> + Send; fn first_acceptable<F>( self, accept: F, ) -> impl Future<Output = Option<(OwnedServerName, R)>> + Send where F: Fn(&R) -> bool + Send; }
Expand description

Adds terminal aggregations to a federation outcome stream.

Each fold preserves per-origin failures while applying caller policy only to successful typed responses.

Required Methods§

Source

fn merge<T, F>( self, init: T, merge: F, ) -> impl Future<Output = (T, Faults)> + Send
where T: Send, F: Fn(T, R) -> T + Send,

Merges successful responses and retains per-origin faults.

Successful values are folded in completion order from the supplied seed.

Source

fn grid<K, I, F>(self, extract: F) -> impl Future<Output = Grid<K>> + Send
where K: Ord + Send, I: IntoIterator<Item = K>, F: Fn(R) -> I + Send,

Inverts extracted response data into origin sets.

Successful responses with no extracted data enter the empty-origin set.

Source

fn tally(self) -> impl Future<Output = Tally> + Send

Partitions destinations into successful origins and faults.

The partition retains origin identity and each terminal failure reason.

Source

fn first_acceptable<F>( self, accept: F, ) -> impl Future<Output = Option<(OwnedServerName, R)>> + Send
where F: Fn(&R) -> bool + Send,

Returns the first completed successful response accepted by a predicate.

Dropping the search future cancels any remaining stream work.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, R> OutcomeExt<R> for S
where S: Stream<Item = Outcome<R>> + Send + Sized, R: Send,