mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-06 12:25:03 +00:00
refactor: replace containerIdx with ContainerID
in refactor module
This commit is contained in:
parent
87887b1b2c
commit
b747452ced
3 changed files with 11 additions and 8 deletions
|
@ -8,8 +8,6 @@ use crate::container::{ContainerID, ContainerIdx};
|
|||
///
|
||||
#[derive(Clone)]
|
||||
pub(super) struct SharedArena {
|
||||
containers: Vector<ContainerID>,
|
||||
id_to_idx: im::HashMap<ContainerID, ContainerIdx>,
|
||||
/// The parent of each container.
|
||||
parents: Vector<Option<ContainerIdx>>,
|
||||
parents: im::HashMap<ContainerID, ContainerID>,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use fxhash::FxHashMap;
|
||||
|
||||
use crate::container::ContainerIdx;
|
||||
use crate::container::{ContainerID, ContainerIdx};
|
||||
|
||||
/// Calculate the diff between two versions. given [OpLog][super::oplog::OpLog]
|
||||
/// and [AppState][super::state::AppState].
|
||||
#[derive(Default)]
|
||||
pub(super) struct DiffCalculator {
|
||||
calc: FxHashMap<ContainerIdx, ContainerDiffCalculator>,
|
||||
calc: FxHashMap<ContainerID, ContainerDiffCalculator>,
|
||||
}
|
||||
impl DiffCalculator {
|
||||
pub(crate) fn calc(
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
use enum_dispatch::enum_dispatch;
|
||||
use fxhash::FxHashMap;
|
||||
|
||||
use crate::{container::ContainerIdx, event::Diff, version::Frontiers, VersionVector};
|
||||
use crate::{
|
||||
container::{ContainerID, ContainerIdx},
|
||||
event::Diff,
|
||||
version::Frontiers,
|
||||
VersionVector,
|
||||
};
|
||||
|
||||
use super::arena::SharedArena;
|
||||
|
||||
|
@ -17,7 +22,7 @@ use text_state::TextState;
|
|||
pub struct AppState {
|
||||
vv: VersionVector,
|
||||
frontiers: Frontiers,
|
||||
state: FxHashMap<ContainerIdx, State>,
|
||||
state: FxHashMap<ContainerID, State>,
|
||||
arena: SharedArena,
|
||||
}
|
||||
|
||||
|
@ -39,6 +44,6 @@ pub struct AppStateDiff {
|
|||
}
|
||||
|
||||
pub struct ContainerStateDiff {
|
||||
pub idx: ContainerIdx,
|
||||
pub idx: ContainerID,
|
||||
pub diff: Diff,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue