diff options
Diffstat (limited to 'src/remake/switch.rs')
| -rw-r--r-- | src/remake/switch.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/remake/switch.rs b/src/remake/switch.rs index 4c72b39..dd08b38 100644 --- a/src/remake/switch.rs +++ b/src/remake/switch.rs @@ -216,6 +216,7 @@ async fn switch<H: Host>( let actor = ActorId::random(); host.remake().add_own_actor(actor.clone()); let new_actor = actor.clone(); + let node = host.node_id(); // 2. Build (or reuse), verify and replay without holding any lock. let (new_doc, copy_heads, mut stats) = tokio::task::spawn_blocking( @@ -233,8 +234,9 @@ async fn switch<H: Host>( )); } - // A fresh actor: this node's writes in the new epoch. + // A fresh actor: this node's writes in the new epoch, made by it. let mut doc = snapshot.doc.with_actor(actor); + crate::document::replica::authored(&mut doc, &node); let heads = copy.get_heads(); @@ -248,8 +250,15 @@ async fn switch<H: Host>( } // Each write at the time it was made, so later replays judge by it. - let stats = - delta::replay_newest(©, &base, &heads, &mut doc, &translator, superseded); + let stats = delta::replay_newest( + ©, + &base, + &heads, + &mut doc, + &node, + &translator, + superseded, + ); Ok((doc, heads, stats)) }, ) @@ -302,6 +311,7 @@ pub(super) async fn swap_in<H: Host>( translator: Translator, ) -> Result<(Document, ReplayStats), String> { let superseded = host.superseded(); + let node = host.node_id(); // The closure runs on the blocking pool; its replay numbers come back through this. let late_stats = std::sync::Arc::new(std::sync::Mutex::new(ReplayStats::default())); let late_out = std::sync::Arc::clone(&late_stats); @@ -318,6 +328,7 @@ pub(super) async fn swap_in<H: Host>( ©_heads, &live_heads, &mut new_doc, + &node, &translator, superseded, ); |
