diff options
| author | tv <tv@krebsco.de> | 2026-11-01 22:31:49 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 22:31:49 +0100 |
| commit | 422056962f0c53e36d00501d54f710365bc21f65 (patch) | |
| tree | 6d0275eb1e8b584429178b9e9a2935971de485f8 /src/document/sync.rs | |
| parent | 9b976a6c4add3719b8f9afef53578ff778b50aa1 (diff) | |
document: introduce patch log
Diffstat (limited to 'src/document/sync.rs')
| -rw-r--r-- | src/document/sync.rs | 15 |
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 |
