morpheus_network

Module state

Source
Expand description

State machine module.

Non-blocking state machines for all network operations. Each state machine has a step() method that returns immediately.

§Design Principles

  1. No blocking: step() returns immediately, never waits
  2. Timeout as observation: Check elapsed time, don’t spin
  3. State transitions: Move to next state when condition met
  4. Composable: State machines can contain other state machines

§Usage Pattern

loop {
    // Poll network stack (exactly once per iteration)
    iface.poll(now, device, sockets);
     
    // Step state machine (returns immediately)
    match state_machine.step(now_tsc, &timeouts) {
        StepResult::Pending => continue,
        StepResult::Done => break,
        StepResult::Timeout => handle_timeout(),
        StepResult::Failed => handle_error(),
    }
}

§Reference

NETWORK_IMPL_GUIDE.md §5

Re-exports§

Modules§

  • DHCP client state machine.
  • ISO Streaming Disk Writer State Machine.
  • DNS resolution state machine.
  • ISO download orchestration state machine.
  • HTTP download state machine.
  • TCP connection state machine.

Structs§

  • Progress information for long-running operations.
  • Context passed to state machine step functions.
  • TSC timestamp wrapper for timeout calculations.

Enums§