From 362633603e9fc1912fd35807da5653dc1273a5be Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 14:31:03 +0000 Subject: swarm: members read of where the node's document keeps them The swarm reads its members, their addresses, aliases, parties, tiers and links, at _continuum/members of the document the node holds. Where the node's document keeps them apart and hands them over as a tree (AppState::entries: a set of events, Holding::entries), they are read of that (view::members_of): by the topology, the node's registration, stability, working links, the state file's seeds, reach, and the API's aliases, dashboards and tier. No node's document does so yet but one whose store a set carries, which none starts as. --- src/state/mod.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/state/mod.rs') diff --git a/src/state/mod.rs b/src/state/mod.rs index 36dab9d..5fefe11 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -387,6 +387,30 @@ impl AppState { crate::document::KIND } + /// Whether this node's document is a set of events (`federation::store::set`): + /// the Automerge document it holds is empty then, and nothing passes it on. + pub(crate) fn of_a_set(&self) -> bool { + #[cfg(feature = "federation")] + { + self.holding.of_a_set() + } + #[cfg(not(feature = "federation"))] + { + false + } + } + + /// The members' entries as a document has them, where this node's document keeps + /// them apart (a set of events, `Holding::entries`): none, where they are in the + /// document it holds. + pub(crate) fn entries(&self) -> Option { + #[cfg(feature = "federation")] + if self.of_a_set() { + return self.holding.entries(); + } + None + } + pub(crate) fn local_id(&self) -> &str { self.transport.local_id() } -- cgit v1.3.1