Expand description
§cronoq-core
The sans-IO engine of the cronoq elastic priority scheduler. Core is a deterministic,
single-threaded state machine: it never reads a clock, spawns threads or performs I/O. A
driver (the cronoq crate, or a test harness with virtual time) feeds it submissions,
completions and the current Time, and executes the Actions it emits.
use cronoq_core::*;
let mut core: Core<&str> = Core::new(CoreConfig::default());
let t0 = Time::ZERO;
core.submit(t0, TaskSpec::new("hello").priority(Priority::High)).unwrap();
let Some(Action::Dispatch(d)) = core.poll_action() else { panic!() };
assert_eq!(*d.payload, "hello");
core.complete(Time::from_secs_f64(0.5), d.lease, Outcome::Success);Structs§
- Autoscale
Config - Queue-pressure autoscaling parameters (see SPEC §10).
- Autoscale
State - Per-pool autoscaler state: smoothed rates, the last target and the history used for scale-down stabilization.
- Bounds
- Maximum number of not-yet-running tasks.
- Core
- The scheduling engine. See the crate docs.
- Core
Config - Complete engine configuration.
- Dep
- A dependency on another task. The dependent becomes eligible once every edge is satisfied
and ends as
Skippedas soon as one edge can no longer be satisfied. - Dispatch
- A task handed to an executor.
- DurStats
- Observed runtimes for a
(pool, kind)(seconds). - Fairness
- Weighted fair sharing of a pool between tenants (
TaskSpec::tenant). - Fixed
Start - A start time the scheduler plans capacity for: a worker slot is reserved at admission and
held free shortly before
at. - Group
Snapshot - Capacity of the workers of a pool that share one label set.
- Histogram
- Log-linear histogram over nanoseconds (8 sub-buckets per power of two, ~9% resolution).
- LeaseId
- Identifies one dispatch (attempt) of a task.
- Pool
Config - A worker pool: capacity limits, scaling, retries, queue bounds and fixed-start behaviour.
- PoolId
- Index of a pool in the engine configuration.
- Pool
Snapshot - State and windowed quality metrics of one pool.
- Priority
Config - Per-class score parameters:
base + min(aging_rate * wait, age_cap) + urgency. - Recovered
- Engine state restored from durable storage, passed to
Core::recover. - Recovered
Recurring - A recurring schedule restored from durable storage.
- Recovered
Task - A non-terminal task restored from durable storage.
- Recovered
Terminal - A recently finished task restored into the retention table (for late dependents).
- Recurring
Info - A recurring schedule, as listed by
Core::list_recurring. - Recurring
Spec - A cron schedule that submits a fixed-start task from
templateat each occurrence. - Resource
Config - A named resource tasks can require (concurrency or rate limit), shared across pools.
- Resource
Id - Index of a resource in the engine configuration.
- Retry
Policy - Retry behaviour for retryable failures.
- Signals
- Signals sampled at each evaluation.
- Snapshot
- Engine-wide snapshot returned by
Core::snapshot. - Status
Event - Status transition event.
- Submitted
- Result of an accepted submission.
- TaskId
- Engine-assigned task identifier (monotonic; the high 16 bits carry the leader epoch).
- Task
Spec - Everything the engine needs to schedule one task.
- Task
Summary - A live task, as listed by
Core::list_tasks. - Ticket
- Caller-chosen correlation id for submissions.
- Time
- Engine time: nanoseconds since the engine epoch.
- Totals
- Engine-wide totals since start.
- Urgency
Config - Deadline urgency curve (monotonically increasing as slack shrinks).
Enums§
- Abort
Reason - Why the engine aborted an attempt.
- Action
- Something the driver must do.
- Edge
Cond - When a dependency edge is satisfied by its parent’s terminal status.
- Miss
Policy - What to do when a fixed-start task could not start within its tolerance.
- Mutation
- Durable state change (emitted only with
CoreConfig::persist). - Outcome
- Result of one attempt, reported by the executor.
- Overflow
Policy - Behaviour when a submission would exceed queue bounds.
- Overlap
Policy - Overlap behaviour for recurring schedules.
- Priority
- Priority class. Lower discriminant = more important.
- Resource
Kind - Kind of a shared resource.
- Submit
Error - Why a submission was rejected.
- TaskRef
- Reference to another task, used for dependencies and cancellation.
- Task
Status - Lifecycle status of a task.
- Unknown
Dependency - How to treat a dependency on a key the engine has never seen.
Functions§
- default_
name - Shared
"default"name, so building a spec does not allocate for kind and pool.