Skip to main content

exec_viz/
lib.rs

1#![feature(default_field_values)]
2//! DAG-activations replay for any `trading_data` graph: one computation structure, multiple
3//! interpretations. Prod evals via `step`; here the same tick chain runs under a recording
4//! [`trading_data_dag::Observer`], and the browser replays it tick-by-tick — layers lighting up,
5//! values flowing — next to a candle chart.
6//!
7//! A library, not a runner. The app owns the graph, the feed and the runtime; it attaches a
8//! [`Recorder`], hands it to its own `tick_obs`, and drives [`Viz::serve_on`] on a port of its
9//! choosing. Every handler reads whatever has been recorded so far, so the server can run
10//! *alongside* the recording — [`Viz::bind`] is separate precisely so the URL answers before the
11//! work begins:
12//!
13//! ```ignore
14//! let (viz, mut rec) = Viz::new(Some(<Bar1m as Cell>::NAME), 100_000, 60_000, Backpressure::Block);
15//! let server = viz.clone().serve_on(Viz::bind(port).await);
16//! tokio::join!(server, async {
17//!     let out = graph.tick_obs(ts_ns, batches, &mut rec.at(ts_ns));
18//!     rec.seal(); // a finite recording says so; a live feed just drops the recorder
19//! });
20//! ```
21//!
22//! The recording runs on its own thread: the graph's leg of it is two renderings into a recycled
23//! buffer and one channel push. [`Backpressure`] is what a full handoff means — a replay waits for
24//! the tape, a live feed does not.
25//!
26//! It owns no front-end either: the browser half is the sibling `exec_viz_web` bin, and the app
27//! points `EXEC_VIZ_WEB_DIR` at a built bundle of it.
28
29pub mod api_types;
30
31#[cfg(feature = "server")]
32mod cost;
33#[cfg(feature = "server")]
34pub mod record;
35#[cfg(feature = "server")]
36mod server;
37#[cfg(feature = "server")]
38mod tape;
39#[cfg(feature = "server")]
40pub use server::web_dir;
41#[cfg(feature = "server")]
42pub use tape::{Backpressure, Rec, Recorder, Tape, Viz};