Skip to main content

preferred_node_order

Function preferred_node_order 

Source
pub fn preferred_node_order(
    placement: &NamespacePlacement,
) -> Vec<Option<String>>
Expand description

The ordered node-filter tiers an UNPINNED row consults for the Prefer{L} two-tier spill (Control-Plane Phase 2, P2-P3) — the SINGLE source of the prefer-then-spill sequence consulted by WorkerOutboxDispatch, which since #52 R4 selects for BOTH transports — so “prefer labelled worker, spill to any” cannot mean two things, because only one walk derives it.

The returned sequence is a list of node filters to try IN ORDER, stopping at the first that has a live worker:

  • Prefer{L} → each label in L (deterministic BTreeSet order) as Some(label), then a final None spill tier (any live worker). An empty L collapses to just the None spill.
  • Unplaced → a single None tier (any live worker).

Pinned{L} is NOT dispatched through this fn: worker_selection_for routes it to the NON-spilling WorkerSelection::Required decision (require an L-labelled worker, WAIT on absence, never spill — P2-I1, #164). The Pinned arm here is only the internal fall-through of the soft Prefer path and never satisfies a hard pin.

This is consulted ONLY for an unpinned row (row.node == None): an authored Some(N) pin is authoritative and never enters this path. The result is a pure worker-SELECTION input; it never mutates the recorded row’s node (the determinism invariant, CP-Phase-2 §2.4).