diff options
| author | tv <tv@krebsco.de> | 2026-11-05 16:10:14 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-05 16:10:14 +0100 |
| commit | 065bf2f9e738eae219da1fe0557ec22f94f10b7a (patch) | |
| tree | 4c4b8191cc7902898a776c429b6b9d09a798d26c /src/document | |
| parent | 12fae75f850c3ca63a68378b2684b5d89f667e10 (diff) | |
waiting not twice
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/changes.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/document/changes.rs b/src/document/changes.rs index 1091261..9a07fc0 100644 --- a/src/document/changes.rs +++ b/src/document/changes.rs @@ -8,6 +8,13 @@ use anyhow::{Context, Result, anyhow, bail}; use super::{Change, ChangeHash, Document, ReadDoc}; +/// Whether `doc` has every change of `heads`. +pub(crate) fn holds_all(doc: &Document, heads: &[ChangeHash]) -> bool { + heads + .iter() + .all(|head| doc.get_change_by_hash(head).is_some()) +} + /// Whether the history of `theirs` (of them, those `doc` has) holds all of `ours` /// (heads of `doc`): a peer at `theirs` has every change we have. pub(crate) fn covers(doc: &Document, theirs: &[ChangeHash], ours: &[ChangeHash]) -> bool { |
