Skip to main content

Module daemon

Module daemon 

Source
Expand description

borg mesh serve: one node, running until it is told to stop.

  • Accepts members dialling in, each session in its own task (sync.rs gates every one).
  • Dials every member listed in peers.json: every interval, and at once when the store changed locally (a hook wrote a lesson or an excerpt, a session brought new lines, revoke re-signed the membership), checked every poll. Each peer is dialled on its own, side by side: one that does not answer holds up no other for its timeout. A change made while a peer’s dial runs, or that a failed dial did not carry, is owed to it and dialled once that dial ends or its backoff is over. A changed membership is applied to the logs (quarantine) at once, before the round. New lines therefore travel on: what B learns from A reaches C in B’s next round, at the next poll once the session ends.
  • Backs off per peer on failure: poll after the first, then interval · 2^(failures - 1), at most backoff_max; a success resets it. A failed dial also drops the peer from mesh/synced.json (borg presence.rs).
  • Re-checks the gate every round on the config as it is then: once the collective turns local or off (or the repo moves to another store) no round dials anyone, and incoming sessions are refused by sync.rs. Turning it back on resumes without a restart.
  • Stops cleanly when shutdown resolves: no new sessions, running ones get grace, then the endpoint closes (peers see a closed connection, not a timeout).

Not a coordinator: every node runs the same loop, and the hooks never depend on it.

Structs§

Options
The loop’s timing. Default is the one place its values are written: borg mesh serve’s --interval default and the bounds of the one-shot commands (main.rs) read them from it.

Enums§

Event
What the loop tells its caller (the CLI prints it, tests count it).

Functions§

serve

Type Aliases§

State