From 1343cc9bdacb6dc7b31652b4529ec843d11d1625 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 20:49:42 +0000 Subject: topology: in a swarm holding a store, neighbours among its members In a swarm holding a store, a node computes its neighbours, and the member list's graph writers' trees are built on, from the members its store names, each with the party its entry names (`docs/store.md`, Members): the other entries name nodes it doesn't sync with. While it holds no store, from every entry, as elsewhere. --- src/swarm/topology/mod.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs index 8fae0ed..1d42724 100644 --- a/src/swarm/topology/mod.rs +++ b/src/swarm/topology/mod.rs @@ -376,6 +376,29 @@ pub(crate) fn with_recorded( graph } +/// Of the member list `listed`, in a swarm holding a store, the members its store names, +/// each with the party its entry names (`federation::held`): the others, a node doesn't +/// sync with (`swarm::peer::members`). All while the node holds no store. +#[cfg(feature = "federation")] +fn of_the_store( + state: &AppState, + doc: &crate::document::Document, + listed: Vec, +) -> Vec { + if !state.holding.tells_members() { + return listed; + } + listed + .into_iter() + .filter(|member| { + state + .holding + .member(member, members::party(doc, member).as_deref()) + == Some(true) + }) + .collect() +} + /// Whether `peer` is in the member list, as the view was last computed from it; None /// while the view isn't known. pub(crate) fn listed(state: &AppState, peer: &str) -> Option { @@ -686,6 +709,8 @@ pub(crate) async fn refresh(state: &AppState) -> Option { let k = swarm_neighbours(&replica.doc, state.neighbours_k); switch_ways(state, swarm_ways(&replica.doc, state.configured_ways)); let current = members::members(&replica.doc); + #[cfg(feature = "federation")] + let current = of_the_store(state, &replica.doc, current); // Those that said they are alive within the electorate window. let alive: BTreeSet = members::electorate( &replica.doc, -- cgit v1.3.1