Skip to main content

Crate cronoq_core

Crate cronoq_core 

Source
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§

AutoscaleConfig
Queue-pressure autoscaling parameters (see SPEC §10).
AutoscaleState
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.
CoreConfig
Complete engine configuration.
Dep
A dependency on another task. The dependent becomes eligible once every edge is satisfied and ends as Skipped as 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).
FixedStart
A start time the scheduler plans capacity for: a worker slot is reserved at admission and held free shortly before at.
GroupSnapshot
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.
PoolConfig
A worker pool: capacity limits, scaling, retries, queue bounds and fixed-start behaviour.
PoolId
Index of a pool in the engine configuration.
PoolSnapshot
State and windowed quality metrics of one pool.
PriorityConfig
Per-class score parameters: base + min(aging_rate * wait, age_cap) + urgency.
Recovered
Engine state restored from durable storage, passed to Core::recover.
RecoveredRecurring
A recurring schedule restored from durable storage.
RecoveredTask
A non-terminal task restored from durable storage.
RecoveredTerminal
A recently finished task restored into the retention table (for late dependents).
RecurringInfo
A recurring schedule, as listed by Core::list_recurring.
RecurringSpec
A cron schedule that submits a fixed-start task from template at each occurrence.
ResourceConfig
A named resource tasks can require (concurrency or rate limit), shared across pools.
ResourceId
Index of a resource in the engine configuration.
RetryPolicy
Retry behaviour for retryable failures.
Signals
Signals sampled at each evaluation.
Snapshot
Engine-wide snapshot returned by Core::snapshot.
StatusEvent
Status transition event.
Submitted
Result of an accepted submission.
TaskId
Engine-assigned task identifier (monotonic; the high 16 bits carry the leader epoch).
TaskSpec
Everything the engine needs to schedule one task.
TaskSummary
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.
UrgencyConfig
Deadline urgency curve (monotonically increasing as slack shrinks).

Enums§

AbortReason
Why the engine aborted an attempt.
Action
Something the driver must do.
EdgeCond
When a dependency edge is satisfied by its parent’s terminal status.
MissPolicy
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.
OverflowPolicy
Behaviour when a submission would exceed queue bounds.
OverlapPolicy
Overlap behaviour for recurring schedules.
Priority
Priority class. Lower discriminant = more important.
ResourceKind
Kind of a shared resource.
SubmitError
Why a submission was rejected.
TaskRef
Reference to another task, used for dependencies and cancellation.
TaskStatus
Lifecycle status of a task.
UnknownDependency
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.

Type Aliases§

Labels
Sorted (name, value) labels of a worker group.
Tags
Key/value labels attached to a task.