diff options
| author | tv <tv@krebsco.de> | 2026-10-31 18:07:07 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 18:07:07 +0100 |
| commit | 70beae3b936ee445659e471f40e59ffaa1e1a3d7 (patch) | |
| tree | 91e24e4c7cf2c739c2cec0f8a6190362d66a45f0 /src/swarm/sync.rs | |
| parent | 37815998b9d37a45f440864f6d3149c3ce9e69f1 (diff) | |
move all automerge references to document
Diffstat (limited to 'src/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 40e577a..3cbe5f3 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -389,15 +389,11 @@ pub(crate) async fn handle_sync( // Now by the peers' clocks (their median): this node's own clock skew // doesn't count; the writer's still does. let now_ms = clock.now_millis().as_u64() as i64 - ahead_ms; - // Time 0: not stamped (snapshots, older nodes). - let delays: Vec<i64> = replica - .doc - .get_changes(&heads_before) - .iter() - .map(|change| change.timestamp()) - .filter(|&time| time > 0) - .map(|time| now_ms - time) - .collect(); + let delays: Vec<i64> = + crate::document::changes::commit_times(&mut replica.doc, &heads_before) + .into_iter() + .map(|time| now_ms - time) + .collect(); stats.propagated(delays); } @@ -505,11 +501,7 @@ async fn download_and_apply_delta( let heads_before = replica.heads().to_vec(); crate::document::changes::load_delta(&mut replica.doc, &bytes)?; replica.refresh_heads(); - let missing = spec - .to - .iter() - .filter(|head| replica.doc.get_change_by_hash(head).is_none()) - .count(); + let missing = crate::document::changes::missing(&mut replica.doc, &spec.to).len(); if missing > 0 { bail!("{missing} of the offered heads are still missing after loading"); } |
