pub trait DynAccumulator: Send {
// Required methods
fn add_event(&mut self, event: &Event);
fn merge_dyn(&mut self, other: &dyn DynAccumulator);
fn result_scalar(&self) -> ScalarResult;
fn is_empty(&self) -> bool;
fn clone_box(&self) -> Box<dyn DynAccumulator>;
fn serialize(&self) -> Vec<u8> ⓘ;
fn result_field(&self) -> Field;
fn type_tag(&self) -> &'static str;
fn as_any(&self) -> &dyn Any;
}Expand description
Dynamic accumulator trait for composite aggregation.
Unlike the static Accumulator trait, this works with events directly
and returns ScalarResult for type-flexible output. Used by
CompositeAggregator to combine multiple aggregates per window.
§Ring Architecture
Dynamic dispatch has overhead (~2-5ns per vtable call), so composite
aggregation is intended for Ring 1 workloads. Ring 0 continues to use
the static Aggregator + Accumulator path.
Required Methods§
Sourcefn merge_dyn(&mut self, other: &dyn DynAccumulator)
fn merge_dyn(&mut self, other: &dyn DynAccumulator)
Merges another accumulator of the same type into this one.
§Panics
May panic if other is not the same concrete type.
Sourcefn result_scalar(&self) -> ScalarResult
fn result_scalar(&self) -> ScalarResult
Returns the current aggregate result.
Sourcefn clone_box(&self) -> Box<dyn DynAccumulator>
fn clone_box(&self) -> Box<dyn DynAccumulator>
Creates a boxed clone of this accumulator.
Sourcefn serialize(&self) -> Vec<u8> ⓘ
fn serialize(&self) -> Vec<u8> ⓘ
Serializes the accumulator state to bytes (for checkpointing).
Sourcefn result_field(&self) -> Field
fn result_field(&self) -> Field
Returns the Arrow field descriptor for this accumulator’s output.