aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,