aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/topology
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-06 04:32:33 +0100
committertv <tv@krebsco.de>2026-11-06 04:32:33 +0100
commit8a37ace76af52a3497213d5aa5531c85726e1ef6 (patch)
tree27ab40363dfa46f5ba95c73a1bcd1dae6f7919c6 /src/swarm/topology
parentc85e4efec5bf8c5d83401816b6de4f46fbedd99e (diff)
links member from the view
Diffstat (limited to 'src/swarm/topology')
-rw-r--r--src/swarm/topology/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs
index 179cf83..b001809 100644
--- a/src/swarm/topology/mod.rs
+++ b/src/swarm/topology/mod.rs
@@ -100,6 +100,16 @@ pub(crate) fn member_list_graph(
})))
}
+/// 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> {
+ state
+ .neighbours
+ .read_or_recover()
+ .as_ref()
+ .map(|view| view.members.iter().any(|member| member == peer))
+}
+
/// Whether the neighbours are computed from the member list yet (before, everyone
/// counts as a neighbour).
pub(crate) fn view_known(state: &AppState) -> bool {