pub struct SessionSignals { /* private fields */ }Expand description
Tracks session-level signals automatically from events.
Every call to on_event updates the
corresponding keys under session: in the shared State, making
them available to instruction templates, watchers, and computed vars.
Performance: Timestamps use AtomicU64 (nanos since session start)
instead of Mutex<Instant>. Derived timing signals are flushed
periodically via flush_timing() (100ms interval) rather than per-event.
Implementations§
Source§impl SessionSignals
impl SessionSignals
Sourcepub fn on_event(&self, event: &SessionEvent)
pub fn on_event(&self, event: &SessionEvent)
Process an event — updates state keys and atomic timestamps.
This is the per-event handler. It updates boolean flags, counters,
and atomic timestamps. Derived timing (silence_ms, elapsed_ms,
remaining_budget_ms) is NOT computed here — call flush_timing()
periodically instead.
Sourcepub fn flush_timing(&self)
pub fn flush_timing(&self)
Flush derived timing signals to state.
Call this periodically (e.g., every 100ms) from the telemetry lane.
Computes silence_ms, elapsed_ms, and remaining_budget_ms from
atomic timestamps without any mutex locks.
Sourcepub fn session_type(&self) -> SessionType
pub fn session_type(&self) -> SessionType
Returns the current session type based on whether video has been sent.
Sourcepub fn latest_resume_handle(&self) -> Option<String>
pub fn latest_resume_handle(&self) -> Option<String>
Returns the latest resumption handle for reconnection.
Sourcepub fn mark_video_sent(&self)
pub fn mark_video_sent(&self)
Mark that video has been sent (changes session type to AudioVideo).