#[non_exhaustive]pub struct WorkerState {
pub node_index: usize,
pub node_count: usize,
pub current_tick: Ticks,
pub readiness: Readiness,
pub backpressure: WatermarkState,
pub last_step: Option<StepResult>,
pub last_error: bool,
}Expand description
Per-worker state snapshot for scheduling decisions.
Populated by the codegen-generated worker loop before each
WorkerScheduler::decide call. Edge occupancy is queried from concrete
edge types (no dyn dispatch) and summarised here.
Extensibility model: #[non_exhaustive] — fields will be added as
planned work lands. The codegen loop queries edges using concrete types
(no dyn) and populates this snapshot. The scheduler never touches edges
directly — it only sees the snapshot. New edge capabilities
(peek_header, mailbox, urgency) are exposed by adding fields here, with
the codegen loop doing the actual querying.
Planned extensions (one field per planned item):
earliest_deadline: Option<DeadlineNs>(R1 — from peeked input headers)max_input_urgency: Option<Urgency>(R1 — highest urgency among inputs)inputs_fresh: bool(R2 — all inputs within max_age threshold)input_liveness_ok: bool(R5 — all inputs within liveness threshold)micros_since_last_step: u64(R6 — for node liveness violation detection)criticality: CriticalityClass(R8 — node’s criticality tier)input_count: usize/inputs_ready_count: usize(C2 — N→M per-port)
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.node_index: usizeIndex of this node in the graph.
node_count: usizeTotal number of nodes in the graph.
current_tick: TicksCurrent clock tick (monotonic). Enables freshness/liveness calculations without the scheduler needing a clock reference.
readiness: ReadinessReadiness derived from input availability and output pressure.
backpressure: WatermarkStateMax output backpressure (watermark across all outputs).
last_step: Option<StepResult>Result of the last step, if any.
last_error: boolWhether the last step errored (NodeError details go to telemetry).
Implementations§
Trait Implementations§
Source§impl Clone for WorkerState
impl Clone for WorkerState
Source§fn clone(&self) -> WorkerState
fn clone(&self) -> WorkerState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more