aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 22:31:49 +0100
committertv <tv@krebsco.de>2026-11-01 22:31:49 +0100
commit3adacb1818816da62f636a29f5d88103eca633e2 (patch)
tree569b0ca89970e79ec2584d8d0e6f23e0d64c6ac6 /src/document/sync.rs
parentb5d29103f19db42fb2f813f551e0ada68bc1c782 (diff)
document: introduce patch log
Diffstat (limited to 'src/document/sync.rs')
-rw-r--r--src/document/sync.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/document/sync.rs b/src/document/sync.rs
index 2119eda..44ad833 100644
--- a/src/document/sync.rs
+++ b/src/document/sync.rs
@@ -165,13 +165,26 @@ impl SyncSession {
/// Applies a sync message from the peer to `doc`. Doesn't settle the awaited
/// answer: the caller measures the exchange first (`reply`).
+ #[cfg(test)]
pub(crate) fn receive(
&mut self,
doc: &mut Document,
message: Received,
) -> Result<(), AutomergeError> {
+ self.receive_logged(doc, message, &mut automerge::PatchLog::inactive())
+ }
+
+ /// Applies a sync message from the peer to `doc`, what it changes recorded in `log`
+ /// (`Replica::logged`). Doesn't settle the awaited answer: the caller measures the
+ /// exchange first (`reply`).
+ pub(crate) fn receive_logged(
+ &mut self,
+ doc: &mut Document,
+ message: Received,
+ log: &mut automerge::PatchLog,
+ ) -> Result<(), AutomergeError> {
self.delta_offered = false;
- doc.receive_sync_message(&mut self.state, message.0)
+ doc.receive_sync_message_log_patches(&mut self.state, message.0, log)
}
/// The message just generated is too large to send in one piece: take back what it