From 097d86915a7935ab4b7674f3dc6c0368ba16ed67 Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Wed, 12 Jul 2023 21:29:21 +0800 Subject: [PATCH] refactor: rm next lamport from app state diff --- crates/loro-internal/src/refactor/loro.rs | 2 -- crates/loro-internal/src/refactor/state.rs | 11 +---------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/crates/loro-internal/src/refactor/loro.rs b/crates/loro-internal/src/refactor/loro.rs index a04acdd8..3e10cc48 100644 --- a/crates/loro-internal/src/refactor/loro.rs +++ b/crates/loro-internal/src/refactor/loro.rs @@ -65,7 +65,6 @@ impl LoroApp { state.apply_diff(AppStateDiff { diff: &diff, frontiers: oplog.frontiers(), - next_lamport: oplog.latest_lamport + 1, }); } @@ -109,7 +108,6 @@ impl LoroApp { state.apply_diff(AppStateDiff { diff: &diff, frontiers: oplog.frontiers(), - next_lamport: oplog.latest_lamport + 1, }); } diff --git a/crates/loro-internal/src/refactor/state.rs b/crates/loro-internal/src/refactor/state.rs index ec32f571..4f5d4423 100644 --- a/crates/loro-internal/src/refactor/state.rs +++ b/crates/loro-internal/src/refactor/state.rs @@ -4,7 +4,6 @@ use fxhash::{FxHashMap, FxHashSet}; use ring::rand::SystemRandom; use crate::{ - change::Lamport, configure::SecureRandomGenerator, container::{registry::ContainerIdx, ContainerIdRaw}, event::Diff, @@ -84,7 +83,6 @@ pub struct ContainerStateDiff { pub struct AppStateDiff<'a> { pub(crate) diff: &'a [ContainerStateDiff], pub(crate) frontiers: &'a Frontiers, - pub(crate) next_lamport: Lamport, } impl AppState { @@ -106,14 +104,7 @@ impl AppState { self.peer = peer; } - pub fn apply_diff( - &mut self, - AppStateDiff { - diff, - frontiers, - next_lamport, - }: AppStateDiff, - ) { + pub fn apply_diff(&mut self, AppStateDiff { diff, frontiers }: AppStateDiff) { if self.in_txn { panic!("apply_diff should not be called in a transaction"); }