aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/passing.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 04:00:43 +0000
committertv <tv@krebsco.de>2026-11-29 04:00:43 +0000
commit2ae7562083f5f96490f90e9398762cf6a024d51e (patch)
tree5e23c6bda5682e39413fe557348023cc4204d487 /src/document/passing.rs
parentf497cf6ef14de8204bc1edec078116593d791b97 (diff)
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.
Diffstat (limited to 'src/document/passing.rs')
-rw-r--r--src/document/passing.rs16
1 files changed, 12 insertions, 4 deletions
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<ChangeHash>,
+ pub(crate) roots: Vec<super::UnitId>,
/// 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<bool>,
/// Whose the changes it brought are, whether any is nobody's, and when each was made.
- pub(crate) authors: Vec<(String, Vec<ChangeHash>)>,
+ pub(crate) authors: Vec<(String, Vec<super::UnitId>)>,
pub(crate) unauthored: bool,
pub(crate) times: Vec<i64>,
/// 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 {