diff options
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 |
