mirror of
https://github.com/loro-dev/loro.git
synced 2024-11-28 17:41:49 +00:00
fix: yata fuzzing now works
This commit is contained in:
parent
5ca3a42a0b
commit
b11fe7394e
4 changed files with 11 additions and 2 deletions
|
@ -77,6 +77,11 @@ impl Tracker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// check whether id_to_cursor correctly reflect the status of the content
|
||||||
|
fn check_consistency(&self) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
fn turn_on(&mut self, _id: IdSpan) {}
|
fn turn_on(&mut self, _id: IdSpan) {}
|
||||||
fn turn_off(&mut self, _id: IdSpan) {}
|
fn turn_off(&mut self, _id: IdSpan) {}
|
||||||
fn checkout(&mut self, _vv: VersionVector) {}
|
fn checkout(&mut self, _vv: VersionVector) {}
|
||||||
|
|
|
@ -62,6 +62,7 @@ pub enum StatusChange {
|
||||||
pub(super) type YSpanTreeTrait = CumulateTreeTrait<YSpan, 10>;
|
pub(super) type YSpanTreeTrait = CumulateTreeTrait<YSpan, 10>;
|
||||||
|
|
||||||
impl YSpan {
|
impl YSpan {
|
||||||
|
/// this is the last id of the span, which is **included** by self
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn last_id(&self) -> ID {
|
pub fn last_id(&self) -> ID {
|
||||||
self.id.inc(self.len as i32 - 1)
|
self.id.inc(self.len as i32 - 1)
|
||||||
|
@ -77,7 +78,7 @@ impl YSpan {
|
||||||
pub fn contain_id(&self, id: ID) -> bool {
|
pub fn contain_id(&self, id: ID) -> bool {
|
||||||
self.id.client_id == id.client_id
|
self.id.client_id == id.client_id
|
||||||
&& self.id.counter <= id.counter
|
&& self.id.counter <= id.counter
|
||||||
&& self.last_id().counter > id.counter
|
&& self.last_id().counter >= id.counter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{Rle, RleTreeTrait};
|
||||||
use super::{node::LeafNode, tree_trait::Position};
|
use super::{node::LeafNode, tree_trait::Position};
|
||||||
|
|
||||||
/// when len > 0, it acts as a selection. When iterating the tree, the len should be the size of the element.
|
/// when len > 0, it acts as a selection. When iterating the tree, the len should be the size of the element.
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
pub struct UnsafeCursor<'tree, 'bump, T: Rle, A: RleTreeTrait<T>> {
|
pub struct UnsafeCursor<'tree, 'bump, T: Rle, A: RleTreeTrait<T>> {
|
||||||
pub leaf: NonNull<LeafNode<'bump, T, A>>,
|
pub leaf: NonNull<LeafNode<'bump, T, A>>,
|
||||||
pub index: usize,
|
pub index: usize,
|
||||||
|
@ -32,11 +32,13 @@ impl<'tree, 'bump, T: Rle, A: RleTreeTrait<T>> Clone for UnsafeCursor<'tree, 'bu
|
||||||
impl<'tree, 'bump: 'tree, T: Rle, A: RleTreeTrait<T>> Copy for UnsafeCursor<'tree, 'bump, T, A> {}
|
impl<'tree, 'bump: 'tree, T: Rle, A: RleTreeTrait<T>> Copy for UnsafeCursor<'tree, 'bump, T, A> {}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct SafeCursor<'tree, 'bump, T: Rle, A: RleTreeTrait<T>>(
|
pub struct SafeCursor<'tree, 'bump, T: Rle, A: RleTreeTrait<T>>(
|
||||||
pub(crate) UnsafeCursor<'tree, 'bump, T, A>,
|
pub(crate) UnsafeCursor<'tree, 'bump, T, A>,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct SafeCursorMut<'tree, 'bump, T: Rle, A: RleTreeTrait<T>>(
|
pub struct SafeCursorMut<'tree, 'bump, T: Rle, A: RleTreeTrait<T>>(
|
||||||
pub(crate) UnsafeCursor<'tree, 'bump, T, A>,
|
pub(crate) UnsafeCursor<'tree, 'bump, T, A>,
|
||||||
);
|
);
|
||||||
|
|
|
@ -137,6 +137,7 @@ impl<'tree, 'bump: 'tree, T: Rle, A: RleTreeTrait<T>> Iterator for Iter<'tree, '
|
||||||
end.offset - cursor.offset,
|
end.offset - cursor.offset,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
cursor.offset = end.offset;
|
||||||
self.cursor = None;
|
self.cursor = None;
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue