diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/stats.rs | 2 | ||||
| -rw-r--r-- | src/api/stats/prometheus.rs | 6 | ||||
| -rw-r--r-- | src/swarm/topology/mod.rs | 10 |
3 files changed, 7 insertions, 11 deletions
diff --git a/src/api/stats.rs b/src/api/stats.rs index 0bdb1b6..5061ff7 100644 --- a/src/api/stats.rs +++ b/src/api/stats.rs @@ -187,7 +187,6 @@ struct TopologyView { stable: usize, neighbours: usize, stable_neighbours: usize, - full_mesh: bool, } #[derive(Debug, Serialize)] @@ -359,7 +358,6 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR stable: s.stable, neighbours: s.neighbours, stable_neighbours: s.stable_neighbours, - full_mesh: s.full_mesh, }), }, stability: StabilityStats { diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs index 5b1fc8c..595466a 100644 --- a/src/api/stats/prometheus.rs +++ b/src/api/stats/prometheus.rs @@ -713,12 +713,6 @@ pub(super) fn render(stats: &StatsResponse, list: &PeerListResponse) -> String { "Current neighbours with the stable tier.", view.stable_neighbours as f64, ); - out.single( - "full_mesh", - "gauge", - "1 while every reachable member is a neighbour.", - flag(view.full_mesh), - ); } let stability = &stats.stability; diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs index b876fd0..afa13ee 100644 --- a/src/swarm/topology/mod.rs +++ b/src/swarm/topology/mod.rs @@ -57,7 +57,10 @@ pub(crate) struct NeighbourView { /// they say they sync with us (`refresh`). outbound: BTreeSet<String>, neighbours: BTreeSet<String>, - /// Every reachable member is a neighbour. + /// Every member not judged unreachable is a neighbour (the tests wait for it, + /// `is_full_mesh`). Not the swarm being a full mesh: members on a transport we are + /// not on, or that we never reached, don't count against it. + #[cfg(test)] full_mesh: bool, /// The graph the member list gives, as if every member reached every other /// (`member_list_graph`): computed when first asked for, kept while the member list @@ -123,7 +126,6 @@ pub(crate) struct Summary { pub(crate) stable: usize, pub(crate) neighbours: usize, pub(crate) stable_neighbours: usize, - pub(crate) full_mesh: bool, } pub(crate) fn summary(state: &AppState) -> Option<Summary> { @@ -146,7 +148,6 @@ pub(crate) fn summary(state: &AppState) -> Option<Summary> { .iter() .filter(|m| view.stable.contains(*m)) .count(), - full_mesh: view.full_mesh, }) } @@ -412,6 +413,7 @@ pub(crate) async fn refresh(state: &AppState) -> Option<NeighbourChange> { &|m| stable.contains(m), ); computed.extend(outbound.iter().cloned()); + #[cfg(test)] let listed_neighbours = computed.len(); computed.extend(unlisted.iter().cloned()); let change = NeighbourChange { @@ -438,11 +440,13 @@ pub(crate) async fn refresh(state: &AppState) -> Option<NeighbourChange> { removed = change.removed.len(), "Neighbours computed from the member list" ); + #[cfg(test)] let reachable_others = current .iter() .filter(|m| m.as_str() != state.local_id() && !unreachable.contains(*m)) .count(); *state.neighbours.write_or_recover() = Some(NeighbourView { + #[cfg(test)] full_mesh: listed_neighbours >= reachable_others, members: current, k, |
