cronoq-core 0.2.0

Sans-IO core engine of the cronoq elastic priority scheduler
Documentation

cronoq-core

crates.io docs.rs

The sans-IO scheduling engine behind cronoq. Core is a deterministic state machine with no clock, threads, I/O or unsafe: every call takes the current time, and the engine answers with actions (dispatch, abort, scale, persist, publish).

It implements priority classes with aging, deadline urgency (EDF), fixed-start reservations with worker holds, cron schedules, DAG dependencies, leases, retries, semaphores and token buckets, bounded queues with shedding, queue-pressure autoscaling and windowed metrics, with O(classes + log n) dispatch.

use cronoq_core::*;

let mut core: Core<&str> = Core::new(CoreConfig::default());
core.submit(Time::ZERO, TaskSpec::new("hello").priority(Priority::High)).unwrap();
let Some(Action::Dispatch(d)) = core.poll_action() else { panic!("expected a dispatch") };
core.complete(Time::from_secs_f64(0.5), d.lease, Outcome::Success);

Use it directly to build a custom driver (another runtime, a simulator) or to test scheduling policies under virtual time. Most applications should use the cronoq crate instead.

Licensed under MIT or Apache-2.0, at your option.