cfe7bad0ff
M3 machinery for BLOCKER #138: sink reductions can now fold online instead of buffering every per-cycle row to an unbounded channel. - aura-core: additive `Node::finalize` end-of-stream hook (default no-op) + `SeriesFold` online accumulator (last / max_drawdown / sign_flips). - aura-engine: `Harness::run` calls `finalize` once per node in topo order after the source loop; `summarize` refactored to drive `SeriesFold` (byte-identical), the now-dead `sign0` removed. - aura-std: `GatedRecorder` (emits only gated rows + the final row on finalize) and `SeriesReducer` (folds one f64 series, emits one summary row on finalize), both emitting the `Recorder` channel type — no aura-engine dependency. - Integration tests: folded reductions are byte-for-byte equal to the raw-recorder path; the R-reduction's peak memory is O(trades), independent of cycle count. Ratified two off-plan fixes the implementer made in the tests (both plan defects, not code defects): the GatedRecorder correctly flushes the final non-gated row on finalize, so the retained count is K_TRADES + 1; and the heterogeneous PM record needs kind-correct zero scalars (a blanket f64 zero is rejected by the kind-typed AnyColumn::push). Wiring these reducers into the stage1-r sweep (the actual O(cycles)->O(trades) win) follows next. refs #138
50 lines
1.8 KiB
Rust
50 lines
1.8 KiB
Rust
//! `aura-core` — the shared contract every aura component links against.
|
|
//!
|
|
//! This crate is the boundary forced by the cdylib hot-reload model: both the
|
|
//! engine and every hot-reloadable node cdylib depend on it, so it stays small
|
|
//! and stable.
|
|
//!
|
|
//! Delivered so far (cycle 0001 — the streaming substrate):
|
|
//!
|
|
//! - the four scalar base types streamed as SoA: [`Scalar`] / [`ScalarKind`] /
|
|
//! [`Timestamp`] (C7);
|
|
//! - [`Column`] — a fixed-capacity, bounded-lookback ring with financial
|
|
//! indexing (index 0 = newest) and a `run_count` freshness primitive (C5/C8),
|
|
//! read zero-copy through a [`Window`];
|
|
//! - [`AnyColumn`] — the type-erased edge over the four column kinds, with an
|
|
//! edge-time kind check ([`KindMismatch`]) (C7).
|
|
//!
|
|
//! Delivered in cycle 0002 — the node contract:
|
|
//!
|
|
//! - [`Node`] — the `lookbacks`/`eval` contract every node implements (C8); the
|
|
//! static signature ([`NodeSchema`] / [`PortSpec`] declaring input ports by kind
|
|
//! and the output record of [`FieldSpec`] columns; length 1 = scalar) is declared
|
|
//! on the node's [`PrimitiveBuilder`], pre-build;
|
|
//! - [`Ctx`] — the per-`eval` read-side: zero-copy, financial-indexed [`Window`]
|
|
//! access into each input (closing the cycle-0001 read-side gap on
|
|
//! [`AnyColumn`]).
|
|
//!
|
|
//! Still to come (subsequent cycles): the broker-independent
|
|
//! position-event output and downstream broker nodes (C10), and the run registry
|
|
//! (C18/C22).
|
|
|
|
mod any;
|
|
mod cell;
|
|
mod column;
|
|
mod ctx;
|
|
mod error;
|
|
mod node;
|
|
mod scalar;
|
|
mod series_fold;
|
|
|
|
pub use any::AnyColumn;
|
|
pub use cell::Cell;
|
|
pub use column::{Column, Window};
|
|
pub use ctx::Ctx;
|
|
pub use error::KindMismatch;
|
|
pub use node::{
|
|
zip_params, FieldSpec, Firing, Node, NodeSchema, ParamSpec, PortSpec, PrimitiveBuilder,
|
|
};
|
|
pub use scalar::{Scalar, ScalarKind, Timestamp};
|
|
pub use series_fold::SeriesFold;
|