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
commitd7433f9d34c299e7ce31542aede80d2530c1e45f (patch)
treee6653872b6822a1b04523d8b8444b75d972ba783 /src/document/sync.rs
parent3e115a7e9cc5846d6c1025a7297a006c2d64709b (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