Skip to main content

hpc_node/
lib.rs

1//! # hpc-node
2//!
3//! Shared contracts for node-level resource management between HPC systems.
4//!
5//! This crate defines traits and types for:
6//! - **cgroup v2 conventions** (`cgroup`): slice naming, ownership, scope management
7//! - **Namespace handoff** (`namespace`): protocol for passing namespace FDs between processes
8//! - **Mount management** (`mount`): refcounted mounts with lazy unmount
9//! - **Readiness signaling** (`readiness`): boot readiness gate
10//!
11//! Both pact-agent and lattice-node-agent implement these traits independently.
12//! When pact is init, lattice gains capabilities ("steroids") through the handoff
13//! protocol. When lattice runs standalone, it creates its own hierarchy using the
14//! same conventions.
15//!
16//! ## Design principles
17//!
18//! - **Traits and types only** — no implementations, no Linux-specific code
19//! - **No runtime coupling** — pact and lattice have no runtime dependency on each other
20//! - **Convention over configuration** — well-known paths and constants prevent drift
21
22pub mod cgroup;
23pub mod mount;
24pub mod namespace;
25pub mod readiness;
26
27// Re-export key types at crate root.
28pub use cgroup::{
29    CgroupError, CgroupHandle, CgroupManager, CgroupMetrics, ResourceLimits, SliceOwner,
30};
31pub use mount::{MountError, MountHandle, MountManager};
32pub use namespace::{
33    NamespaceConsumer, NamespaceError, NamespaceProvider, NamespaceRequest, NamespaceResponse,
34    NamespaceType,
35};
36pub use readiness::{ReadinessError, ReadinessGate};