diff options
| author | tv <tv@krebsco.de> | 2026-11-29 04:00:43 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-29 04:00:43 +0000 |
| commit | 2ae7562083f5f96490f90e9398762cf6a024d51e (patch) | |
| tree | 5e23c6bda5682e39413fe557348023cc4204d487 /src/swarm/sync.rs | |
| parent | f497cf6ef14de8204bc1edec078116593d791b97 (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/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 006df9d..bb99547 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -484,9 +484,9 @@ pub(crate) async fn handle_sync( bool, bool, bool, - (Vec<(String, Vec<crate::document::ChangeHash>)>, bool), + (Vec<(String, Vec<crate::document::UnitId>)>, bool), Option<std::time::Duration>, - Option<(u32, Vec<crate::document::ChangeHash>)>, + Option<(u32, Vec<crate::document::UnitId>)>, ); tokio::task::spawn_blocking(move || -> Result<Option<Applied>> { let (payload_len, message) = @@ -658,7 +658,7 @@ pub(crate) async fn handle_sync( } // Caught up: our other neighbours may lack what the source had. if changed || just_caught_up { - let writers: Vec<(u64, Vec<crate::document::ChangeHash>)> = authors + let writers: Vec<(u64, Vec<crate::document::UnitId>)> = authors .into_iter() .map(|(author, changes)| (crate::swarm::topology::pair_key(&author), changes)) .collect(); @@ -856,7 +856,7 @@ async fn download_and_apply_delta( async fn own_changes( state: &AppState, seen_heads: &mut Vec<crate::document::ChangeHash>, -) -> Option<Vec<crate::document::ChangeHash>> { +) -> Option<Vec<crate::document::UnitId>> { let replica = state.doc.read().await; let before = std::mem::replace(seen_heads, replica.heads().to_vec()); if !crate::document::changes::holds_all(&replica.doc, &before) { @@ -867,7 +867,7 @@ async fn own_changes( .authors .into_iter() .find(|(author, _)| author == state.local_id()) - .map(|(_, hashes)| hashes) + .map(|(_, hashes)| hashes.into_iter().map(Into::into).collect()) } pub(crate) async fn run_sync_worker(state: AppState, mut rx: mpsc::UnboundedReceiver<SyncEvent>) { |
