Skip to main content

Module bootstrap

Module bootstrap 

Source
Expand description

Run-owned bootstrap reachability supervision for rings run.

rings connect node and rings connect seed establish a connection once. This module gives the native daemon a set of managed bootstrap targets that it keeps reachable for the life of the process: whenever a target stops being reachable through the overlay, the supervisor redials it through its HTTP endpoint, first in a bounded rapid burst and then on a slow jittered cadence, and resets once the target is reachable again. Ordinary neighbour and finger edges stay under Chord stabilization; only the configured targets are supervised, and a target reachable through other peers is never forced into a direct edge.

The design splits into a pure core and an effect shell:

  • schedule::BootstrapSchedule (private) — the retry state machine, a function of explicit time; its module docs carry the phase diagram and laws.
  • BootstrapPort (crate-private) — the two effects a turn needs: assess reachability and dial; ProcessorPort is the production port over a live processor.
  • BootstrapSupervisor — the shell: wakes on deadlines, target losses and finished turns; runs at most one turn per target; exits on the run’s stop token.
  • evidence::ReachabilityEvidence (crate-private) — what the swarm reports about the targets: admissions the dial waits for and retirements the supervisor reads as losses; written by the Backend through BackendObserver, which the supervisor hands out as BootstrapSupervisor::observer.
                   ┌────────────────────────── run loop ──────────────────────────┐
 StopToken ──stop─▶│ drain losses ─▶ notice_loss ─▶ ∀ due target: begin ─▶ push turn│
 Losses ─────wake─▶│ wait { stop | wake | turn finished | next deadline } ─▶ settle │
                   └──────────────────────────────────────────────────────────────┘

 turn(t) := reachable(t) ? Reachable : dial(t) = Ok ? Reachable : Unreachable

Lost-wakeup freedom: every wait is preceded by a drain of the loss record, and a loss recorded between the drain and the wait leaves a stored permit, so no loss is missed. A turn is bounded: the port bounds its probe, the endpoint’s resolution, each of its two HTTP requests and the admission wait with a timeout of its own, and the core bounds the offer (ICE gathering) and the routed send it performs on the port’s behalf; the one await without a bound of its own is the transport close a cancelled handshake performs.

Shutdown: the loop returns on the first stop observation and its in-flight turns are dropped with it, cancelling any probe or handshake in progress. A pending connection attempt the core already reserved expires under the core’s own pending timeout. Transient failures stay inside the loop; only configuration is validated up front and fails fast.

Structs§

BootstrapSupervisor
The run-owned supervisor; see the module diagram.
BootstrapTargets
Validated managed targets: one per DID, one per endpoint, none of them the local node.