cronoq_core/lib.rs
1//! # cronoq-core
2//!
3//! The sans-IO engine of the cronoq elastic priority scheduler. [`Core`] is a deterministic,
4//! single-threaded state machine: it never reads a clock, spawns threads or performs I/O. A
5//! driver (the `cronoq` crate, or a test harness with virtual time) feeds it submissions,
6//! completions and the current [`Time`], and executes the [`Action`]s it emits.
7//!
8//! ```
9//! use cronoq_core::*;
10//!
11//! let mut core: Core<&str> = Core::new(CoreConfig::default());
12//! let t0 = Time::ZERO;
13//! core.submit(t0, TaskSpec::new("hello").priority(Priority::High)).unwrap();
14//! let Some(Action::Dispatch(d)) = core.poll_action() else { panic!() };
15//! assert_eq!(*d.payload, "hello");
16//! core.complete(Time::from_secs_f64(0.5), d.lease, Outcome::Success);
17//! ```
18#![forbid(unsafe_code)]
19#![warn(missing_docs)]
20
21mod autoscale;
22mod config;
23mod engine;
24mod io;
25mod lane;
26mod reservations;
27mod rng;
28mod snapshot;
29mod spec;
30mod stats;
31mod time;
32
33pub use autoscale::{AutoscaleState, Signals};
34pub use config::*;
35pub use engine::{Core, Totals};
36pub use io::*;
37pub use snapshot::{GroupSnapshot, PoolSnapshot, Snapshot};
38pub use spec::*;
39pub use stats::{DurStats, Histogram};
40pub use time::Time;