Skip to main content

TuiObserver

Struct TuiObserver 

Source
pub struct TuiObserver { /* private fields */ }
Expand description

RunObserver impl that drives crate::app::App from runner lifecycle events.

The TUI terminal takeover (raw mode + alternate screen) is deferred until the first phase actually starts. Pre-phase work runs with plain stderr output. This keeps the terminal clean if the run fails before any activity begins.

Implementations§

Source§

impl TuiObserver

Source

pub fn new(state: RunStateHandle, cadences: Cadences) -> Self

Build a fresh observer over a RunStateHandle. cadences is forwarded to the runner via RunObserver::cadences(). Stderr fallback severity defaults to Info; use Self::with_min_level to override.

Source

pub fn with_min_level(self, min_level: LogLevel) -> Self

Override the minimum severity that the pre-TUI stderr mirror and the post-TUI stderr fallback emit. Has no effect on what the TUI’s in-app log panel shows — that is filtered by the panel’s own LOD knobs.

Source

pub fn shutdown(&self)

Signal the TUI (if running) to exit and wait for the terminal to be restored. Safe to call when the TUI never started.

Trait Implementations§

Source§

impl RunObserver for TuiObserver

Source§

fn op_measure(&self, parent_phase: SceneNodeId, op_name: &str, text: &str)

The op’s KEY MEASURABLE, rendered from its measure: template at completion — “12 sstables”, “1.4 GiB”, “98.1%”. Read more
Source§

fn session_dir_ready(&self, dir: &Path)

The session directory now exists. Display surfaces that persist a transcript open it here — the runner creates the directory well after the observer is built, so this is the first moment the path is known.
Source§

fn sysmon_update(&self, sample: &SysmonSample)

A completed sysmon sample window (session-level host utilization). Display surfaces override; everything else ignores it.
Source§

fn phase_starting( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, op_templates: usize, total_cycles: u64, concurrency: usize, )

A phase is about to start executing. Read more
Source§

fn phase_completed( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, duration_secs: f64, )

A phase completed successfully. scene_node_id keys the node to flip (see Self::phase_starting).
Source§

fn phase_failed( &self, scene_node_id: SceneNodeId, name: &str, labels: &str, error: &str, )

A phase failed. scene_node_id keys the node to flip (see Self::phase_starting).
Source§

fn op_starting(&self, parent_phase: SceneNodeId, op_name: &str)

SRD-63 — an op-level execution leaf became visible (readout: visible, enabled by the readout wrapper). Nests under parent_phase in the hierarchic status view; the consumer assigns its sequence within the phase from arrival order. Default no-op so observers that don’t render op-level leaves (and the zero-cost non-readout path) are unaffected.
Source§

fn op_completed( &self, parent_phase: SceneNodeId, op_name: &str, duration_secs: f64, )

An op-level execution leaf completed. duration_secs is the op’s own cumulative execution time. Default no-op.
Source§

fn op_failed(&self, parent_phase: SceneNodeId, op_name: &str, error: &str)

An op-level execution leaf failed. Default no-op.
Source§

fn phase_progress(&self, update: &PhaseProgressUpdate)

Update live metrics for the active phase (called at progress tick rate).
Source§

fn phase_render_attach(&self, handle: PhaseRenderHandle)

SRD-100 P2 — attach the per-phase PhaseRenderHandle to the live display fold, once, after the activity’s metrics/binder exist (the executor calls this on-task at progress-setup time). Observers that own a run-state actor (TUI / log-only) route it to an AttachPhaseRender mutation so the consumer can fold active_phases and re-derive each phase’s status line itself; the no-op default is correct for surfaces with no live status fold (Stderr / Headless).
Source§

fn run_finished(&self)

The entire run is complete.
Source§

fn log(&self, level: LogLevel, message: &str)

Diagnostic log message. Routed to stderr in CLI mode, to a ring buffer in TUI mode. All eprintln! in the runtime should go through this instead.
Source§

fn log_tagged(&self, level: LogLevel, tag: EventTag, message: &str)

Log a message carrying an explicit EventTag. The default ignores the tag and delegates to Self::log — correct for every observer whose surface treats all events alike. Observers that feed a tag-aware sink (the run-state actor ring) override this to retain both axes.
Source§

fn suppresses_stderr(&self) -> bool

Whether to suppress the inline stderr progress line (because the TUI is handling display).
Source§

fn live_suppress_flag(&self) -> Option<Arc<AtomicBool>>

Optional shared flag mirroring Self::suppresses_stderr that the runner threads into long-lived components (e.g. the activity’s inline status thread) so they can react to dismissal mid-run rather than honoring a snapshot taken at construction. When None, the activity uses a fresh AtomicBool(false) (never suppress). Implementations that go through a TUI (and only those) typically expose their internal “tui_active” flag here.
Source§

fn scenario_pre_mapped(&self, tree: &SceneTree)

Pre-populated scenario tree. Read more
Source§

fn reporters(&self) -> Vec<(Duration, Box<dyn Reporter>)>

Multiple reporters with explicit cadences. The runner calls this once during setup. Each (interval, reporter) entry is registered with the scheduler at that interval. The default implementation returns whatever Self::reporter produced at the base 1s cadence, so existing observers work unchanged.
Source§

fn cadences(&self) -> Option<Cadences>

User-declared cadences for this observer’s consumers (SRD-42). Read more
Source§

fn on_metrics_query(&self, query: Arc<MetricsQuery>)

Callback invoked once the runner has built the shared nmbrs_metrics::metrics_query::MetricsQuery. Observers that render metrics (TUI, CLI status) capture this handle to read cadence windows, now values, and session-lifetime aggregates.
Source§

fn reporter(&self) -> Option<Box<dyn Reporter>>

Optional reporter to register on the metrics scheduler. The runner calls this once during setup. Return None for observers that don’t need metrics frames (like StderrObserver). Read more

Auto Trait Implementations§

§

impl !Freeze for TuiObserver

§

impl !RefUnwindSafe for TuiObserver

§

impl !UnwindSafe for TuiObserver

§

impl Forget for TuiObserver

§

impl Move for TuiObserver

§

impl Send for TuiObserver

§

impl Sync for TuiObserver

§

impl Unpin for TuiObserver
where Arc<ArcSwapAny<Arc<RunState>>>: Unpin, *mut Counter<Channel<RunStateCmd>>: Unpin, *mut Counter<Channel<RunStateCmd>>: Unpin, *mut Counter<Channel<RunStateCmd>>: Unpin, Arc<Atomic<bool>>: Unpin, Arc<Mutex<Vec<Sender<()>>>>: Unpin, Arc<Mutex<Option<Receiver<LogLine>>>>: Unpin, Align1<u8>: Unpin, *mut Counter<Channel<MetricSet>>: Unpin, *mut Counter<Channel<MetricSet>>: Unpin, *mut Counter<Channel<MetricSet>>: Unpin, *const u8 is !null: Unpin, Arc<MetricsQuery>: Unpin, Arc<Inner, System>: Unpin, Arc<Packet<'static, ()>>: Unpin,

§

impl UnsafeUnpin for TuiObserver
where *const ArcInner<ArcSwapAny<Arc<RunState>>> is !null: UnsafeUnpin, PhantomData<ArcInner<ArcSwapAny<Arc<RunState>>>>: UnsafeUnpin, *mut Counter<Channel<RunStateCmd>>: UnsafeUnpin, *mut Counter<Channel<RunStateCmd>>: UnsafeUnpin, *mut Counter<Channel<RunStateCmd>>: UnsafeUnpin, *const ArcInner<Atomic<bool>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin, *const ArcInner<Mutex<Vec<Sender<()>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Vec<Sender<()>>>>>: UnsafeUnpin, *const ArcInner<Mutex<Option<Receiver<LogLine>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Option<Receiver<LogLine>>>>>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *mut Counter<Channel<MetricSet>>: UnsafeUnpin, *mut Counter<Channel<MetricSet>>: UnsafeUnpin, *mut Counter<Channel<MetricSet>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Duration>: UnsafeUnpin, *const ArcInner<MetricsQuery> is !null: UnsafeUnpin, PhantomData<ArcInner<MetricsQuery>>: UnsafeUnpin, *const ArcInner<Inner> is !null: UnsafeUnpin, PhantomData<ArcInner<Inner>>: UnsafeUnpin, *const ArcInner<Packet<'static, ()>> is !null: UnsafeUnpin, PhantomData<ArcInner<Packet<'static, ()>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more