From 2ae7562083f5f96490f90e9398762cf6a024d51e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 04:00:43 +0000 Subject: document: a unit's name, which the swarm passes on by document::UnitId: the name of a unit of a document as its kind has it, an Automerge change's hash. What the swarm announces, forwards along trees, tells a peer it refused and drops is named so (the dissemination, relay, refusals, AppState::drop_taken), and the session is told so what a peer gets from another; a change's hash it is where the document is asked, and on the wire. --- src/document/passing.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/document/passing.rs') diff --git a/src/document/passing.rs b/src/document/passing.rs index f745d42..10b888d 100644 --- a/src/document/passing.rs +++ b/src/document/passing.rs @@ -232,7 +232,7 @@ pub(crate) struct Taken { /// It carried changes, all of them refused before (`screen::Outcome`). pub(crate) refused_again: bool, /// The changes that broke a rule, of those refused. - pub(crate) roots: Vec, + pub(crate) roots: Vec, /// Changes it carried forged under another node's actor. pub(crate) forged: usize, /// The fresh actor this node writes as from now on, where it carried a change of @@ -280,7 +280,7 @@ pub(crate) fn take( heads_before, said, refused_again: outcome.refused_again, - roots: outcome.roots, + roots: outcome.roots.into_iter().map(Into::into).collect(), forged: outcome.forged, fresh_actor: outcome.fresh_actor, }; @@ -305,7 +305,7 @@ pub(crate) struct Settled { /// predecessors (the peer's heads aren't the document's yet), or had come before. pub(crate) waits: Option, /// Whose the changes it brought are, whether any is nobody's, and when each was made. - pub(crate) authors: Vec<(String, Vec)>, + pub(crate) authors: Vec<(String, Vec)>, pub(crate) unauthored: bool, pub(crate) times: Vec, /// Where asked: whether the document holds all the peer said it has. @@ -354,7 +354,15 @@ pub(crate) fn settle( let waits = (carried && !changed).then(|| !super::changes::holds_all(&replica.doc, &taken.said)); let (authors, unauthored, times) = match since { - Some(since) => (since.authors, since.unauthored, since.times), + Some(since) => ( + since + .authors + .into_iter() + .map(|(author, hashes)| (author, hashes.into_iter().map(Into::into).collect())) + .collect(), + since.unauthored, + since.times, + ), None => (Vec::new(), false, Vec::new()), }; Settled { -- cgit v1.3.1