diff options
| author | tv <tv@krebsco.de> | 2026-11-30 17:57:55 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-30 17:57:55 +0000 |
| commit | 08ec65219991c7413c8cdef4ce77434f2a121331 (patch) | |
| tree | 2c9d6f07e435a1ae37c62571579b170374cfbb70 /src/swarm/sync.rs | |
| parent | 00e88cd983766abec32b5a14a8cbf20932a27f3c (diff) | |
A node of both kinds, for a swarm to move to sets by (--store-both)
With store-document, store-both has the node hold its store in the
Automerge document too, and sync with nodes of either kind:
* it says to each peer the kind that peer holds, and passes its set on
to those that hold sets (swarm::set::holds_a_set), the Automerge
document to the others;
* what its set takes of the document goes on to the peers on sets
(Holding::unpassed), and what its set takes of them is put into the
document, as events it lacks are (Holding::lacking);
* its entry in the document is put as its entry in the set
(swarm::set::mirror_entry), and it reads the members of both;
* without the set's file yet, its set is made of the store as it reads
it of its document, with what store-file kept of its own.
A simulation: two nodes on the Automerge document, one on a set, one
of both between them; an event put on either side reaches all four.
Diffstat (limited to 'src/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 5e736a1..3939377 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -63,10 +63,10 @@ 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. + // A set of events is passed on otherwise (`swarm::set`): with a peer that holds + // one, and of the Automerge document a node holds beside one alone, no sync. #[cfg(feature = "federation")] - if state.of_a_set() { + if state.of_a_set() || crate::swarm::set::holds_a_set(state, peer).await { return Ok(()); } |
