From 8e97bcfa65e92da21df912cc5e19cf18027b82b8 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 14:33:09 +0000 Subject: swarm: a node whose store a set of events carries Such a node (Holding::carrying) holds an Automerge document with nothing in it, which nothing passes on, and its set is its document: * swarm::set passes the set on. Where it stands goes in the node's STATUSes as another kind's stamp, and a peer's is given to the set; what the set says besides goes as a SYNC's body; what the set took, of a peer or of the node itself, goes on to the node's other neighbours. What compares stamps for an Automerge document's sake is handed the node's own, and finds nothing to do; the Automerge sync isn't begun. * The node writes its own entry (AppState::mutate_set): what writes protocol data through a view writes to the members' entries as a tree, and what the node's own reads as after is put as its next entry, signed and passed on. Anything else is refused, and so is a write to an Automerge document as such. * An event the node writes (held::write) is offered to the set and passed on; a set lacks nothing of its store to put again. * The node's swarm is its store's, said at its start. A simulation: three such nodes of two parties register, and each holds the others' entries; events put on two of them reach all three, and they come to stand alike, the documents they hold beside empty. --- src/swarm/sync.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/swarm/sync.rs') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index c953752..5e736a1 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -63,6 +63,13 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> { } } + // A set of events is passed on otherwise (`swarm::set`): of the Automerge document + // a node holds beside one, nothing. + #[cfg(feature = "federation")] + if state.of_a_set() { + return Ok(()); + } + let we_ready = state.is_ready().await; let validated_swarm = { -- cgit v1.3.1