pub struct Aggregator { /* private fields */ }Expand description
EIP Aggregator: groups messages by a correlation header, completes via a CompletionCondition,
and emits the folded result via an AggregationStrategy. Storage is pluggable via GroupStore.
Implementations§
Source§impl Aggregator
impl Aggregator
Sourcepub fn new<H>(correlation_header: H, completion_size: usize) -> Aggregator
pub fn new<H>(correlation_header: H, completion_size: usize) -> Aggregator
Back-compat constructor: size-threshold completion, text-concat strategy, in-memory store.
Sourcepub fn with_completion<H>(
correlation_header: H,
completion: Arc<dyn CompletionCondition>,
) -> Aggregator
pub fn with_completion<H>( correlation_header: H, completion: Arc<dyn CompletionCondition>, ) -> Aggregator
Generic constructor with an arbitrary completion condition. Defaults: ConcatText
strategy + InMemoryGroupStore. Override either with Aggregator::with_strategy /
Aggregator::with_store.
Sourcepub fn weighted<H, F>(
correlation_header: H,
weight: F,
threshold: u64,
) -> Aggregator
pub fn weighted<H, F>( correlation_header: H, weight: F, threshold: u64, ) -> Aggregator
Convenience: weighted-quorum completion (Σ weight(msg) ≥ threshold).
Sourcepub fn timed<H>(correlation_header: H, dur: Duration) -> Aggregator
pub fn timed<H>(correlation_header: H, dur: Duration) -> Aggregator
Convenience: lazy timeout completion (see ByTimeout).
Sourcepub fn when<H, F>(correlation_header: H, predicate: F) -> Aggregator
pub fn when<H, F>(correlation_header: H, predicate: F) -> Aggregator
Convenience: predicate completion.
Sourcepub fn with_strategy(self, strategy: Arc<dyn AggregationStrategy>) -> Aggregator
pub fn with_strategy(self, strategy: Arc<dyn AggregationStrategy>) -> Aggregator
Replace the aggregation strategy. Returns self for chaining.
Sourcepub fn with_store(self, store: Arc<dyn GroupStore>) -> Aggregator
pub fn with_store(self, store: Arc<dyn GroupStore>) -> Aggregator
Replace the group store (e.g. swap in a persistent impl). Returns self for chaining.
Sourcepub fn clear_store(&self)
pub fn clear_store(&self)
Clear every in-progress group. Intended for test isolation; not usually needed in production.
Trait Implementations§
Source§impl Clone for Aggregator
impl Clone for Aggregator
Source§fn clone(&self) -> Aggregator
fn clone(&self) -> Aggregator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more