pub struct SessionStatsAccumulator {
block_id: String,
start_ts_ms: i64,
last_activity_ms: i64,
line_count: u64,
token_estimate: u64,
last_flush: Option<Instant>,
}Expand description
In-memory accumulator for session stats. One per controller instance.
All fields are plain integers — no locking needed because each controller
calls record_line from its single async stdout-reader task only.
Fields§
§block_id: StringBlock ID this accumulator belongs to.
start_ts_ms: i64Unix ms when the first line was seen; 0 = not yet set.
last_activity_ms: i64Unix ms of the most-recently flushed line.
line_count: u64Total lines seen since session start.
token_estimate: u64Cumulative token estimate (chars / 4).
last_flush: Option<Instant>Wall-clock instant of the last flush; None = never flushed.
Implementations§
Source§impl SessionStatsAccumulator
impl SessionStatsAccumulator
Sourcepub fn record_line(&mut self, line_len: usize, wstore: &Option<Arc<WaveStore>>)
pub fn record_line(&mut self, line_len: usize, wstore: &Option<Arc<WaveStore>>)
Record one output line of line_len bytes.
Updates in-memory counters. Flushes to the WaveStore if the debounce
interval has elapsed or if this is the very first line (so the
frontend sees session:start_ts_ms promptly).
Auto Trait Implementations§
impl Freeze for SessionStatsAccumulator
impl RefUnwindSafe for SessionStatsAccumulator
impl Send for SessionStatsAccumulator
impl Sync for SessionStatsAccumulator
impl Unpin for SessionStatsAccumulator
impl UnwindSafe for SessionStatsAccumulator
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.