aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/tree.rs')
-rw-r--r--src/swarm/tree.rs18
1 files changed, 11 insertions, 7 deletions
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<BTreeMap<String, Option<String>>> {
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()