helixrouter/lib.rs
1//! # HelixRouter
2//!
3//! Adaptive async compute routing engine for Rust.
4//!
5//! HelixRouter decides *how* work runs — inline, spawned, pooled, batched, or
6//! dropped — on a per-job basis in sub-microsecond time, using live system
7//! pressure, EMA latency history, and an online-learned quality model
8//! ([`neural_router`]).
9//!
10//! ## Modules
11//!
12//! | Module | Purpose |
13//! |---|---|
14//! | [`router`] | Core strategy selection and execution dispatch |
15//! | [`neural_router`] | Online-learning per-job-kind routing quality model |
16//! | [`autoscaler`] | Predictive demand forecasting and capacity recommendations |
17//! | [`config`] | Validated [`RouterConfig`](config::RouterConfig), hot-reload, watch channel |
18//! | [`metrics`] | EMA latency, percentiles, pressure scoring, Prometheus export |
19//! | [`strategies`] | Deterministic CPU-bound compute kernels |
20//! | [`simulator`] | Seeded synthetic workload generation |
21//! | [`web`] | Axum HTTP server, SSE feed, embedded dark dashboard |
22//! | [`types`] | Shared data types: [`Job`](types::Job), [`Strategy`](types::Strategy), [`Output`](types::Output) |
23//!
24//! ## Quick start
25//!
26//! ```no_run
27//! use helixrouter::{config::RouterConfig, router::Router, types::{Job, JobKind}};
28//!
29//! #[tokio::main]
30//! async fn main() {
31//! let router = Router::new(RouterConfig::default());
32//! let job = Job {
33//! id: 1,
34//! kind: JobKind::HashMix,
35//! inputs: vec![42],
36//! compute_cost: 1_000,
37//! scaling_potential: 0.5,
38//! latency_budget_ms: 50,
39//! };
40//! let output = router.submit(job).await;
41//! println!("{output:?}");
42//! }
43//! ```
44
45pub mod autoscaler;
46pub mod config;
47pub mod metrics;
48pub mod neural_router;
49pub mod router;
50/// Simulator module is only available when the `simulation` feature is enabled.
51#[cfg(feature = "simulation")]
52pub mod simulator;
53pub mod strategies;
54pub mod types;
55pub mod web;