feat(#2500): add hive-jobq ResourceTable with atomic all-or-nothing acquire

Named counting-semaphore resources — the Dep::Resource side of the v2
model. A ResourceTable tracks per-name capacity + held counts; unconfigured
names default to capacity 1 (created lazily). try_acquire_all grants every
requested unit or none, leaving the table untouched on failure — so a node
never holds one resource while waiting for another, which is what makes the
scheduler deadlock-free without cycle detection. Duplicate names in a
request are summed; over-capacity requests can never acquire. release_all
saturates rather than underflowing. Runtime scheduler state, not persisted:
held counts are rederived from running nodes on restart. Guard objects
(RAII release, recursive re-entrancy) wrap this in a follow-up.
This commit is contained in:
atlas 2026-07-17 00:50:22 +02:00 committed by mara
commit 29ceca4323
2 changed files with 216 additions and 2 deletions

View file

@ -26,8 +26,10 @@
//! node kind. Resources are held by the acquiring node and released on
//! completion via guard objects, recursive within a group.
//!
//! The resource-acquisition machinery, the guards, and the scheduler loop are
//! follow-ups; this is the data model they build on.
//! The guards and the scheduler loop are follow-ups; the named-counter resource
//! machinery lives in [`resources`], the base this data model builds on.
pub mod resources;
/// Opaque, stable, monotonic node identifier.
///