pub struct RuntimeApiController { /* private fields */ }Expand description
Controller surfaced to handlers. Written by the VMM event loop, read by every handler.
Implementations§
Source§impl RuntimeApiController
impl RuntimeApiController
Sourcepub fn new(
snapshot: ControllerSnapshot,
timeouts: TimeoutTable,
capacity: usize,
) -> (Self, ActionReceiver)
pub fn new( snapshot: ControllerSnapshot, timeouts: TimeoutTable, capacity: usize, ) -> (Self, ActionReceiver)
Build a controller paired with a VMM event loop receiver. The receiver must be drained by the VMM (or a stub for tests / Phase 2 wiring).
capacity is the bounded mpsc capacity; CLAUDE.md § Async recommends 1024.
Sourcepub fn new_with_limits(
snapshot: ControllerSnapshot,
timeouts: TimeoutTable,
capacity: usize,
limits: LimitsState,
) -> (Self, ActionReceiver)
pub fn new_with_limits( snapshot: ControllerSnapshot, timeouts: TimeoutTable, capacity: usize, limits: LimitsState, ) -> (Self, ActionReceiver)
Build a controller with explicit cross-field limits — the production caller
derives host_ram_mib from the live HVF BackendCapabilities; tests use the
default 1 TiB cap.
Sourcepub fn limits_snapshot(&self) -> LimitsSnapshot
pub fn limits_snapshot(&self) -> LimitsSnapshot
Expose the current limits snapshot — tests use this to verify counter progression after PUTs land.
Source§impl RuntimeApiController
impl RuntimeApiController
Sourcepub fn snapshot(&self) -> Arc<ControllerSnapshot>
pub fn snapshot(&self) -> Arc<ControllerSnapshot>
Borrow the current snapshot. Returns an Arc so the caller can drop it without
holding a lock — this is the read-only fast path.
Sourcepub fn store_snapshot(&self, snap: ControllerSnapshot)
pub fn store_snapshot(&self, snap: ControllerSnapshot)
Replace the snapshot atomically. Called by the VMM event loop on every state transition; not exposed to handlers.
Sourcepub fn validate_phase(&self, action: &ApiAction) -> Result<(), ApiError>
pub fn validate_phase(&self, action: &ApiAction) -> Result<(), ApiError>
Validate admissibility synchronously against the cached lifecycle phase.
Per spec § 5.2: pre-flight rejection runs before the channel is ever touched.
Sourcepub async fn dispatch(&self, action: ApiAction) -> Result<ApiResponse, ApiError>
pub async fn dispatch(&self, action: ApiAction) -> Result<ApiResponse, ApiError>
Dispatch an action to the VMM event loop. Applies the per-class timeout.
Sourcepub fn timeouts(&self) -> TimeoutTable
pub fn timeouts(&self) -> TimeoutTable
Borrow the underlying timeout table (used in tests).
Sourcepub fn action_sender(&self) -> ActionSender
pub fn action_sender(&self) -> ActionSender
Borrow the action sender — used for tests that want to bypass dispatch to
drive the channel directly.