From 96d7744dd29a3c783b43a7a6697af7d5d5719a10 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Nov 2026 05:20:59 +0100 Subject: add writer trees --- docs/peers.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs') diff --git a/docs/peers.md b/docs/peers.md index 763f6aa..9118fde 100644 --- a/docs/peers.md +++ b/docs/peers.md @@ -313,6 +313,22 @@ says, for as long as it is fresh (two STATUS refreshes and a keepalive: 7 minute the default keepalive), and nothing goes into the document. `GET /peers` shows it (`localReaches`, and `reaches` per peer). +A writer's changes pass on along its tree ([`swarm/tree.rs`](../src/swarm/tree.rs)), the same on every node: +built on the graph the member list gives (as if every member reached every other) and +on whom each member says it reaches. Members are ordered by their distance from the +writer over that graph, then by key; a member's parent is the neighbour it reaches that +comes before it, the closest to the writer first, then by pair score. Coming before +rules out cycles; taking only one it reaches routes around links that don't work (one +behind NAT that reaches a single member takes that one). A sync message that passes a +writer's change on says whose; whoever applies one sends it at once to its children in +that writer's tree, however it got it, and leaves them out of its announcement round. +A member without a parent it reaches, or whose parent missed the change, gets it by +announcement and pull as before, then passes it on to its own children. With every link +working, each member gets each change once (`bench_writer_trees`: 1999 messages per +change at 2000 members, against about 25,000 by announcements alone, at most 5 hops); +with 5% of the links down, more than 90% get it along the tree, the rest after one or +two announcement rounds. + ## Keepalive and self-healing ```mermaid -- cgit v1.3.1