From 5994b49412c058079639585501a78e6458fdbb6f Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 6 Nov 2026 19:54:09 +0100 Subject: HyParView (slim) --- src/state/mod.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/state/mod.rs') diff --git a/src/state/mod.rs b/src/state/mod.rs index d5c18b3..3dfc6b1 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -68,10 +68,17 @@ pub(crate) struct AppState { pub(crate) peer_states: Arc>>>>, pub(crate) transport: Arc, - /// How members' neighbours are chosen (`swarm::topology::Topology`). - pub(crate) topology: Arc, - /// How a change reaches every member (`swarm::dissemination::Dissemination`). - pub(crate) dissemination: Arc, + /// How members' neighbours are chosen (`swarm::topology::Topology`), and how a change + /// reaches every member (`swarm::dissemination::Dissemination`): as the swarm + /// records them (`swarm::topology::swarm_ways`), swapped when that changes; + /// `--topology` and `--dissemination` until then (`configured_ways`). + pub(crate) ways: Arc>, + /// `--topology` and `--dissemination`: what a genesis node records, and what counts + /// where the swarm records nothing this node knows. + pub(crate) configured_ways: ( + crate::swarm::topology::Kind, + crate::swarm::dissemination::Kind, + ), pub(crate) firewall: Arc, /// Messages and bytes exchanged, per peer (`transport::traffic`). pub(crate) traffic: Arc, @@ -253,6 +260,16 @@ impl AppState { .collect() } + /// How members' neighbours are chosen now (`ways`). + pub(crate) fn topology(&self) -> Arc { + Arc::clone(&self.ways.read_or_recover().topology) + } + + /// How a change reaches every member now (`ways`). + pub(crate) fn dissemination(&self) -> Arc { + Arc::clone(&self.ways.read_or_recover().dissemination) + } + pub(crate) fn lock_rtt(&self) -> std::sync::MutexGuard<'_, crate::swarm::rtt::RttTable> { self.rtt.lock_or_recover() } -- cgit v1.3.1