Link states¶
A link is in one of four states, and the state is recorded rather than inferred. Knowing which one a link is in tells you whether work is still flowing, whether position is still held, and what will happen when the other side answers again.
stateDiagram-v2
[*] --> Establishing
Establishing --> Established
Established --> Degraded
Degraded --> Established
Degraded --> Broken
Established --> Broken
Broken --> Recovering
Recovering --> Established
Recovering --> Broken
Where each link's state is recorded¶
flowchart LR
subgraph XD["XRATUD, holds both records"]
direction TB
CPS[("Control-plane link<br/>xratud.cp_transport_state.v1")]
subgraph H["RUNTIME HANDLE, per kernel"]
direction TB
KS[("Kernel link state<br/>and return cursor")]
end
end
CP["Control plane"]
K["Kernel"]
CPS -.- CP
KS -.- K
Both states live on the node, one for the control-plane link and one per kernel, so the node's own records answer which link is in which state.
The four states¶
| State | Means | Position |
|---|---|---|
| Establishing | Identity, versions and readiness are being agreed | Not yet held |
| Established | Exchanges are succeeding | Advancing |
| Degraded | Exchanges are failing and the link is being retried | Held, not advancing |
| Broken | The other side is answering a terminal refusal | Held, and will not advance until the cause is resolved |
| Recovering | The link is re-establishing and position is being reconciled | Being restored |
Degraded and broken are different in one respect that matters: degraded is a failure, and the node retries. Broken is a refusal, and the node stops.
The control plane link records its state¶
The node keeps the state as a document under
xratud.cp_transport_state.v1, with two modes:
The record carries what a diagnosis needs, including how long the outage has been running and when the next attempt is due:
mode, reason, last_operation
consecutive_failures, last_error, last_error_epoch
last_retry_backoff_seconds, retry_at_epoch
degraded_since_epoch, transition_count, last_transition
last_success_epoch
A transition is logged once, on the edge, rather than on every failed attempt.
transition_count counts flaps, so a link that is oscillating is
distinguishable from one that has been down steadily.
On recovery the node computes how long it was degraded from
degraded_since_epoch and records the outage length, so the duration of a
break is a measured value rather than an estimate from log timestamps.
Degraded changes behaviour, not just status¶
Entering degraded mode suppresses assignment watch intake. The node stops asking for new work while it cannot reliably talk to the control plane, and keeps running what it already holds.
That is the difference between a degraded link and a slow one. A slow link still takes work; a degraded one stops taking new work and protects what is in flight.
The kernel link's states are the refusal set¶
The kernel link does not keep a mode document. Its state is whatever its last answer was, and the answers are a closed set. Nine reasons exist, seven of them terminal, and a terminal answer puts the link in broken rather than degraded. See Detecting a kernel link break.
Position outlives every state¶
In all four states the node's position is durable: the watch revision, the assignment leases, the telemetry outbox cursor and the kernel return lane's acked sequence. A link that changes state does not reset any of them.
See Detection for who notices a change and how fast, and What a break never loses for the invariants that hold across all four.