pub struct StreamMaxTracker {
pub per_stream: BTreeMap<u64, Vec<(f64, u64)>>,
pub flat: BTreeMap<u64, u64>,
pub sum_series: Vec<(f64, u64)>,
/* private fields */
}Expand description
Tracks monotonically increasing per-stream values with efficient sum calculation. Handles out-of-order events by taking max value seen per stream.
Fields§
§per_stream: BTreeMap<u64, Vec<(f64, u64)>>Full time series per stream.
flat: BTreeMap<u64, u64>Current maximum per stream.
sum_series: Vec<(f64, u64)>Cumulative sum time series.
Implementations§
Source§impl StreamMaxTracker
impl StreamMaxTracker
pub fn new() -> Self
Sourcepub fn update(
&mut self,
stream_id: u64,
new_value: u64,
ev_time: f64,
init_val: u64,
) -> Option<(u64, u64)>
pub fn update( &mut self, stream_id: u64, new_value: u64, ev_time: f64, init_val: u64, ) -> Option<(u64, u64)>
Updates stream value, returns Some((old_max, new_max)) if changed.
pub fn get_stream_max(&self, stream_id: u64) -> Option<u64>
pub fn current_sum(&self) -> u64
Trait Implementations§
Source§impl Debug for StreamMaxTracker
impl Debug for StreamMaxTracker
Auto Trait Implementations§
impl Freeze for StreamMaxTracker
impl RefUnwindSafe for StreamMaxTracker
impl Send for StreamMaxTracker
impl Sync for StreamMaxTracker
impl Unpin for StreamMaxTracker
impl UnsafeUnpin for StreamMaxTracker
impl UnwindSafe for StreamMaxTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more