From 93defc68f9b99da921f4746e91e5cee9e6e3f1b9 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 17:39:23 +0000 Subject: swarm: a node says to each peer the kind that peer holds, of those it holds A node holds one kind of document, or, to come, its store in both (Holding::kinds, of_both). The kind a peer's handshakes say is kept with the peer, where the node holds it too, and is what the node says to it in turn; to a peer that said none yet, a node of more than one kind says each in turn, HELLO by HELLO, until one is answered. A node of one kind says and takes that one, as before. --- src/state/mod.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/state/mod.rs') diff --git a/src/state/mod.rs b/src/state/mod.rs index 21478de..0ffa91e 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -381,14 +381,17 @@ impl AppState { *self.closing.borrow() } - /// The kind of this node's document (`document::KIND`, or a set of events where - /// one carries its store). - pub(crate) fn kind(&self) -> &'static str { + /// The kinds of document this node holds, which it says in handshakes: more than + /// one where it holds its store in both (`Holding::kinds`). + pub(crate) fn kinds(&self) -> &'static [&'static str] { #[cfg(feature = "federation")] - if self.holding.of_a_set() { - return self.holding.kind(); + { + self.holding.kinds() + } + #[cfg(not(feature = "federation"))] + { + &[crate::document::KIND] } - crate::document::KIND } /// Whether this node's document is a set of events (`federation::store::set`): -- cgit v1.3.1