Expand description
Opt-in feature catalog. Each submodule is gated by its own Cargo feature flag and adds a specific capability to the base timer wheel without bloating the core build.
See Cargo.toml [features] for the catalog + the README’s
“Features” section for per-feature p99 + memory cost + use cases.
Modules§
- concurrent
- Thread-safe timer wheel: short-mutex wrapper around the base
TimerWheel. Schedule + cancel + tick all serialize on a singleMutexbecause the critical sections are O(1) (or O(slot) on tick - bounded by entries-in-bucket, typically tiny). - cron
- Minimal cron-expression parser + recurring scheduler.
- deadline_
scheduler - Absolute-deadline scheduling layer on top of the base wheel.
Callers schedule against wall-clock instants (“fire at t=…”) and
drive the scheduler with
poll()calls. The wheel itself stays tick-counted; the layer translates between instant deltas and tick deltas via an injectedClockso the workload is deterministic under test. - hierarchical
- Hierarchical timer wheel (HHW). Three levels, each a wheel of
64 slots: seconds, minutes (each slot = 64 ticks), hours (each
slot = 64*64 ticks). A timer scheduled
dticks out lands on the coarsest wheel whose slot can hold it; on each tick of a higher wheel we cascade its expiring slot’s entries down to the lower wheel re-binned at the residual offset. - metrics
- Metered timer wheel: thin wrapper around the base
TimerWheelthat tracks per-instance counters. Counters are plainu64fields - no atomics, no locks - because the underlying wheel is itself single-threaded. Pair with theconcurrentfeature for a thread-safe metered surface (wrap aMeteredTimerWheelinside a mutex of your own).