Skip to main content

spectra_runtime/
lib.rs

1//! Runtime assembly: builder, async storage persist, and optional off-thread telemetry I/O.
2//!
3//! Application crates usually depend on `spectra` instead of this crate directly.
4//!
5//! - [`Spectra::builder()`] / [`SpectraBuilder`] — inject backends, optional transport sink, and
6//!   topology flags
7//! - [`SpectraBuilder::persist`] — L2 queue/batch settings ([`PersistConfig`]; no env knobs)
8//! - [`Spectra::flush_persist`] — durable barrier after `*_now` emits (Write Now scripts)
9//! - [`SpectraBuilder::sink`] + [`SpectraBuilder::persist_disabled`] — **publisher** wiring for
10//!   distributed ingest (consumers own storage; see `spectra` **Getting started → Mode 2**)
11//! - [`StoragePersistSink`] — default async persist to registered storage backends
12//! - [`OffThreadSpectraSink`] — off-thread NDJSON + console mirror (`telemetry-console` feature)
13//! - Both `metrics_backend` and `events_backend` are required before [`SpectraBuilder::build`].
14//! - With `persist_disabled`, a transport [`.sink`](SpectraBuilder::sink) is mandatory.
15
16mod async_writer;
17mod builder;
18mod persist_config;
19mod persist_sink;
20
21pub use async_writer::{
22    console_mirror_enabled, format_console_line, off_thread_emit_enabled, OffThreadSpectraSink,
23};
24pub use builder::{Spectra, SpectraBuilder};
25pub use persist_config::{PersistConfig, PersistOverflow};
26pub use persist_sink::{PersistHandle, StoragePersistSink};