One core, two front ends
ergo-aeron-tools is a library with the behaviour in it, and two thin front
ends over it behind features: the command line (cli) and the terminal
(tui, which needs cli). A desktop front end can be added the same way,
with no behaviour of its own.
cnc.dat, mapped read-only→read: checks the file's lengths before each read that trusts them, then returns a plain-data Snapshot, with each counter's key, registration id and owner id→Monitor: poll / update, apply(Action)→screen(): rows, matches, selection, healthTap::poll: whole messages, skips counted (a Feed thread polls it each millisecond)→Monitor::take: decoded with the schemas, per-type countsEmbedded driver→Viewer::poll: a guarded subscription that leaves when behind and rejoins live, and counts what its driver filled in for lost data from the loss report (on a Feed thread too)→Monitor::takesemanticType, the name of its type, its description, its extension attributes), read by ergo-sbe-inspect→Interpreter: the rules that say what a value means, first match wins: a converter you registered, a decimal the schema declares, the rest of the schema, the field's name, the value→Messages: the meaning beside the raw value, in the decoded column, the preview and the message's JSONLog::open: opened by Monitor itself while the detail is open (when it opens, moves to another stream or a new read arrives), not fed in by a front end→screen().detail: the log's main fields above the row's columnsArchiveFeed: a thread per source, dir_tab each read period; for Recordings a Listing over Online that lists in full once a minute and asks only for new and not-yet-stopped recordings between→Monitor::take_archive: the Recordings and Archive dir tabs, recording lag from the counters; with no --control, an archive seen in the counters (archive::seen) adds a counters-only Recordings tab, and the session is asked for only by its keystart_replay, no stop request)→Replay::poll: whole messages from the replay's own session (on a Feed thread that waits for room instead of dropping)→Monitor::take_replay: the Payload tab, decoded and searched as the Messages tabcounters --explain→counter_docs looks up system and type ids; links reads ids and relationships from the full snapshot→explain: detail rows and jump targets for the terminal, text or JSON fields for the command lineMonitor starts with the standard ones; none: the values stay as they are), health, key table, regular-expression filter and preview search, view state with the history picker, log inspector, action table and write gate with the action log (a write takes the approval only once its intent line is on disk), the writer flow (menu, preview, typed token, result), a heartbeat-only read for waiting on a driver, embedded driver and viewer, history file, archive directory reader, recording lag, and (feature archive, on by default) the read-only archive session through the tool's own driver with --embedded else the attached one; no terminal or window typestyle, with cli): shared colour roles, icon sets and row styling for both front ends, and the roles of a decoded message's texttui): keys → Key, clicks → Action; opens the tap, viewer, replay or schemas the core asks for; starts the archive readers (the control one also when the core asks for it); runs a confirmed write off the draw thread; turns mouse capture on and off and writes a copied preview as OSC 52; draws screen() with colour and status iconscommand line (cli): flags → reads, tap or viewer polls (with interpret::toml for --converters), a log walk, archive reads, a gated action or the history; prints the core's tables with optional styling, JSON, counter explanations or messages| Layer | Holds | Never holds |
|---|---|---|
| Core (no features) | reading the driver (read, Snapshot); the passive tap (tap::Tap) and its reader thread (tap::Feed); embedded mode’s own driver and guarded viewer (embedded); the history file (history); decoding messages (messages) and what their values mean (interpret); the log inspector (log), which Monitor itself calls to read the open Streams detail’s log metadata; the action table, its write gate and the one run of a write (actions), the action log whose intent line the write requires (action_log), the terminal UI’s writer flow of menu, preview, typed token and result (writer), and a heartbeat-only read (snapshot::pulse) for waiting on a driver; the archive readers: an archive directory’s files (archive_dir) and a read-only control session (feature archive, on by default; it alone needs a JDK to build), a recording’s replay back to the tool (archive::replay) plus recording lag and the archive seen in the counters (archive), with the archive tabs’ reader threads (archive::ArchiveFeed); the counter catalogue (counter_docs), what a counter links to (links) and both as text and JSON (explain); every tab as a table and as JSON; health and the version guard; the key table; the list filter and the preview’s regex search; the view state of every tab (selection, sort, filter and its matches, detail, preview with its matches, pause, mark, help), changed only by Monitor::apply | any terminal, window or command-line type |
Presentation (style, with cli) | the colour role of each meaning, the four icon sets and their detection, and what a row of each tab looks like (healthy, lagging, dead), read from the table’s cells: one definition for both front ends (Colour and icons) | behaviour of the view: it never changes the core’s rows, text or JSON |
| Command line | turning flags into reads (one, two for health, or one per --watch period), tap polls (messages), a log walk (log), archive reads (recordings, recording, recording-lag, archive-dir) or a gated action (driver terminate, which the core runs and waits on), and printing the core’s tables with optional colour and icons, JSON, counter explanations or messages | formatting of its own |
| Terminal | turning keys and mouse events into the core’s Key and Action, opening the tap, viewer, replay or schemas the core asks for (the Streams and Recordings tabs, the history picker), starting the archive readers (the control one also when Monitor::take_connect_request asks for it) and handing their rows to Monitor::take_archive, running a confirmed write off the draw thread (writer::InFlight), and drawing Monitor::screen() | selection, filter, search, sort or health logic |
The command line takes its reads from a function (cli::run_with), so the
command outputs in this book are what the real command prints for a hand-built
driver read, and a test fails when they drift.
The core never owns the event loop. A front end calls Monitor::poll on its
own tick and Monitor::apply (or Monitor::key) for input, then draws
Monitor::screen(). So behaviour is tested once, on the core alone, with
scripted actions and no terminal; the terminal’s tests cover drawing, mouse
hit-testing and key mapping only.
just policy keeps it that way: it runs cargo tree -p ergo-aeron-tools --no-default-features and fails if a terminal, command-line or window crate
appears.