Skip to main content

Module placement_cache

Module placement_cache 

Source
Expand description

Short-TTL per-namespace placement cache for the dispatcher (Control-Plane Phase 2, P2-P3). Short-TTL in-process cache of per-namespace placement directives, read by the non-replayed outbox dispatcher (Control-Plane Phase 2, P2-P3).

The dispatcher consults a namespace’s [NamespacePlacement] on every claimed row to decide preferred-vs-spill worker selection. Reading it straight from the durable [NamespaceStore] each sweep would be a per-row quorum read on the hot claim loop. This cache front-runs get_namespace, holding each namespace’s placement for a short TTL so the steady-state path is a lock + map-lookup, never a store round-trip.

Staleness is benign for the Prefer soft-spill this slice ships: a stale entry only mis-prefers a worker for at most one TTL window — it self-corrects on the next refresh and never affects correctness or replay (placement is a dispatch-time selection input, never written to the recorded row). The TTL is deliberately short so an operator’s PUT /placement takes effect promptly.

Structs§

PlacementCache
A short-TTL cache over NamespaceStore::get_namespace’s placement field.

Enums§

WorkerSelection
How an UNPINNED outbox row (row.node == None) must be dispatched given its namespace’s NamespacePlacement — the SINGLE decision shared by BOTH the gRPC (WorkerOutboxDispatch) and liminal (RegistryLiminalDispatch) dispatch paths, so the two transports can never diverge on Prefer (spill) vs Pinned (require + wait, NEVER spill) semantics.

Functions§

preferred_node_order
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 shared by BOTH the gRPC (WorkerOutboxDispatch) and liminal (RegistryLiminalDispatch) dispatch paths, so the two transports can never diverge on what “prefer labelled worker, spill to any” means.
worker_selection_for
Resolve the WorkerSelection for an unpinned row from its namespace placement. The single seam that keeps Prefer (soft spill) and Pinned (hard require + wait) identical across the gRPC and liminal transports.