From 7c6716358503abee5fab960c45e5fc2de5f61203 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 22:35:10 +0100 Subject: dashboard: the writers' trees as this node knows them The tree drawn is computed as every node computes its own part of it: from the member list, and whom it and its neighbours reach, as they told it; no longer from the links members report over LINKS. Auth plan M3 (preparing LINKS' removal). --- src/swarm/tree.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/swarm/tree.rs') diff --git a/src/swarm/tree.rs b/src/swarm/tree.rs index db3e920..4d5afd8 100644 --- a/src/swarm/tree.rs +++ b/src/swarm/tree.rs @@ -175,18 +175,22 @@ fn parent<'g>( }) } -/// `writer`'s whole tree, as far as `reached` knows whom each member reaches and -/// `round_trip` how far (the dashboard's map, from the links members report): every -/// member's parent, None for those without one (they get the writer's changes by -/// announcement). None while the member list isn't known, or the writer isn't in it. +/// `writer`'s whole tree, as this node knows it (the dashboard's map): whom it and its +/// neighbours reach and how far, as they said (`known_reaches`), the others by the +/// member list's graph, as every member computes its own part (`plan`): every member's +/// parent, None for those without one (they get the writer's changes by announcement). +/// None while the member list isn't known, or the writer isn't in it. #[cfg_attr(not(feature = "dashboard"), allow(dead_code))] -pub(crate) fn whole( +pub(crate) async fn whole( state: &AppState, writer: &str, - reached: &dyn Fn(&str, &str) -> bool, - round_trip: &dyn Fn(&str, &str) -> u8, ) -> Option>> { let (graph, distance) = distances(state, topology::pair_key(writer))?; + let known = known_reaches(state, &graph).await; + let reached = |by: &str, member: &str| known.reached(by, member); + let round_trip = |by: &str, member: &str| known.round_trip(by, member); + let (reached, round_trip): (&dyn Fn(&str, &str) -> bool, &dyn Fn(&str, &str) -> u8) = + (&reached, &round_trip); Some( graph .keys() -- cgit v1.3.1