pub struct StreamBufferTracker {
pub per_stream: BTreeMap<u64, Vec<(f64, StreamAccess)>>,
pub flat: BTreeMap<u64, u64>,
pub sum_series: Vec<(f64, u64)>,
/* private fields */
}Expand description
Tracks monotonically increasing stream buffer positions with efficient sum calculation. Handles out-of-order events by taking max end position (offset
- length) seen per stream.
Fields§
§per_stream: BTreeMap<u64, Vec<(f64, StreamAccess)>>Full time series per stream with StreamAccess details.
flat: BTreeMap<u64, u64>Current maximum end position (offset + length) per stream.
sum_series: Vec<(f64, u64)>Cumulative sum time series.
Implementations§
Source§impl StreamBufferTracker
impl StreamBufferTracker
pub fn new() -> Self
Sourcepub fn update(
&mut self,
stream_id: u64,
access: StreamAccess,
ev_time: f64,
) -> Option<(u64, u64)>
pub fn update( &mut self, stream_id: u64, access: StreamAccess, ev_time: f64, ) -> Option<(u64, u64)>
Updates stream buffer position, 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 StreamBufferTracker
impl Debug for StreamBufferTracker
Auto Trait Implementations§
impl Freeze for StreamBufferTracker
impl RefUnwindSafe for StreamBufferTracker
impl Send for StreamBufferTracker
impl Sync for StreamBufferTracker
impl Unpin for StreamBufferTracker
impl UnsafeUnpin for StreamBufferTracker
impl UnwindSafe for StreamBufferTracker
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