Skip to content

Commit

Permalink
Renamed YjsSpanState to FugueSpanState
Browse files Browse the repository at this point in the history
  • Loading branch information
josephg committed Nov 17, 2023
1 parent e0058bb commit c06c2f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/listmerge/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ mod test {
use crate::dtrange::UNDERWATER_START;
use crate::list::{ListCRDT, ListOpLog};
use crate::listmerge::simple_oplog::SimpleOpLog;
use crate::listmerge::yjsspan::{deleted_n_state, DELETED_ONCE, YjsSpanState};
use crate::listmerge::yjsspan::{deleted_n_state, DELETED_ONCE, FugueSpanState};
use crate::unicount::count_chars;
use super::*;

Expand Down Expand Up @@ -1226,7 +1226,7 @@ mod test {
.collect()
}

fn items_state(tracker: &M2Tracker, filter_underwater: usize) -> Vec<(usize, YjsSpanState)> {
fn items_state(tracker: &M2Tracker, filter_underwater: usize) -> Vec<(usize, FugueSpanState)> {
items(tracker, filter_underwater).iter().map(|i| (i.len(), i.state)).collect()
}

Expand Down
16 changes: 8 additions & 8 deletions src/listmerge/yjsspan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use crate::dtrange::{debug_time, DTRange, UNDERWATER_START};
/// Note a u16 (or even a u8) should be fine in practice. Double deletes almost never happen in
/// reality - unless someone is maliciously generating them.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
pub struct YjsSpanState(u32);
pub struct FugueSpanState(u32);

pub const NOT_INSERTED_YET: YjsSpanState = YjsSpanState(0);
pub const INSERTED: YjsSpanState = YjsSpanState(1);
pub const DELETED_ONCE: YjsSpanState = YjsSpanState(2);
pub const NOT_INSERTED_YET: FugueSpanState = FugueSpanState(0);
pub const INSERTED: FugueSpanState = FugueSpanState(1);
pub const DELETED_ONCE: FugueSpanState = FugueSpanState(2);

pub(super) fn deleted_n_state(n: u32) -> YjsSpanState {
YjsSpanState(1 + n)
pub(super) fn deleted_n_state(n: u32) -> FugueSpanState {
FugueSpanState(1 + n)
}

/// This is a span of sync9 / fugue items. (Those two algorithms generate identical merge
Expand Down Expand Up @@ -48,12 +48,12 @@ pub struct FugueSpan {

/// Stores whether the item has been inserted, inserted and deleted, or not inserted yet at the
/// current moment in time.
pub state: YjsSpanState,
pub state: FugueSpanState,

pub ever_deleted: bool,
}

impl YjsSpanState {
impl FugueSpanState {
/// Note this doesn't (can't) set the ever_deleted flag. Use yjsspan.delete() instead.
fn delete(&mut self) {
if self.0 == NOT_INSERTED_YET.0 {
Expand Down

0 comments on commit c06c2f0

Please sign in to comment.