Skip to main content

WorkerState

Struct WorkerState 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§node_index: usize

Index of this node in the graph.

§node_count: usize

Total number of nodes in the graph.

§current_tick: Ticks

Current clock tick (monotonic). Enables freshness/liveness calculations without the scheduler needing a clock reference.

§readiness: Readiness

Readiness derived from input availability and output pressure.

§backpressure: WatermarkState

Max output backpressure (watermark across all outputs).

§last_step: Option<StepResult>

Result of the last step, if any.

§last_error: bool

Whether the last step errored (NodeError details go to telemetry).

Implementations§

Source§

impl WorkerState

Source

pub const fn new( node_index: usize, node_count: usize, current_tick: Ticks, ) -> Self

Construct a new initial worker state for a given node.

Trait Implementations§

Source§

impl Clone for WorkerState

Source§

fn clone(&self) -> WorkerState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkerState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for WorkerState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.