aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 20:49:42 +0000
committertv <tv@krebsco.de>2026-11-16 22:03:43 +0100
commit1343cc9bdacb6dc7b31652b4529ec843d11d1625 (patch)
treee86ca7178c485d736ee0008cd7b44c7c8e941ec5 /src
parent0e1238015e55854515a4cbc6b6ef757792e7d804 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/swarm/topology/mod.rs25
1 files changed, 25 insertions, 0 deletions
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<String>,
+) -> Vec<String> {
+ 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<bool> {
@@ -686,6 +709,8 @@ pub(crate) async fn refresh(state: &AppState) -> Option<NeighbourChange> {
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<String> = members::electorate(
&replica.doc,