Skip to content

Commit

Permalink
bumpup dbutils version
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Dec 21, 2024
1 parent 2dcf332 commit b081c3d
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 208 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "skl"
version = "0.22.14"
version = "0.22.15"
edition = "2021"
rust-version = "1.81.0"
repository = "https://github.com/al8n/skl"
Expand Down
4 changes: 2 additions & 2 deletions ci/sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUSTFLAGS="--cfg all_skl_tests -Z sanitizer=address" \
cargo test --lib --all-features --target x86_64-unknown-linux-gnu

# Run leak sanitizer
RUSTFLAGS="--cfg all_skl_tests -Z sanitizer=leak" \
cargo test --lib --all-features --target x86_64-unknown-linux-gnu
RUSTFLAGS="--cfg all_skl_tests -Zsanitizer=leak" \
cargo test -Zbuild-std --release --tests --target x86_64-unknown-linux-gnu --features memmap

# Run memory sanitizer
RUSTFLAGS="--cfg all_skl_tests -Zsanitizer=memory -Zsanitizer-memory-track-origins" \
Expand Down
6 changes: 3 additions & 3 deletions src/dynamic/list/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
where
S::Data<'a, &'a [u8]>: Transformable,
{
!self.value.validate()
!S::validate_data(&self.value)
}
}

Expand All @@ -132,13 +132,13 @@ where
/// Returns the next entry in the map.
#[inline]
pub fn next(&self) -> Option<Self> {
self.next_in(<S::Data<'a, &'a [u8]> as Transformable>::always_valid())
self.next_in(S::ALWAYS_VALID)
}

/// Returns the previous entry in the map.
#[inline]
pub fn prev(&self) -> Option<Self> {
self.prev_in(<S::Data<'a, &'a [u8]> as Transformable>::always_valid())
self.prev_in(S::ALWAYS_VALID)
}

fn next_in(&self, always_valid: bool) -> Option<Self> {
Expand Down
20 changes: 10 additions & 10 deletions src/generic/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ where
where
S: State,
S::Data<'a, LazyRef<'a, V>>: Transformable<Input = Option<&'a [u8]>>,
C: TypeRefEquivalentor<K>,
C: TypeRefEquivalentor<'a, K>,
{
loop {
unsafe {
Expand Down Expand Up @@ -499,7 +499,7 @@ where
where
S: State,
S::Data<'a, LazyRef<'a, V>>: Transformable<Input = Option<&'a [u8]>>,
C: TypeRefEquivalentor<K>,
C: TypeRefEquivalentor<'a, K>,
{
loop {
unsafe {
Expand Down Expand Up @@ -557,16 +557,16 @@ where
/// If less=false, it finds leftmost node such that node.key > key (if allow_equal=false) or
/// node.key >= key (if allow_equal=true).
/// Returns the node found. The bool returned is true if the node has key equal to given key.
unsafe fn find_near<Q>(
&self,
unsafe fn find_near<'a, Q>(
&'a self,
version: Version,
key: &Q,
less: bool,
allow_equal: bool,
) -> (Option<<A::Node as Node>::Pointer>, bool)
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
let mut x = self.head;
let mut level = self.meta().height() as usize - 1;
Expand Down Expand Up @@ -666,7 +666,7 @@ where
returned_when_found: bool,
) -> (bool, Option<Pointer>, Option<<A::Node as Node>::Pointer>)
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let list_height = self.meta().height() as u32;
let mut level = 0;
Expand Down Expand Up @@ -745,7 +745,7 @@ where
start: <A::Node as Node>::Pointer,
) -> FindResult<<A::Node as Node>::Pointer>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let mut prev = start;

Expand Down Expand Up @@ -860,7 +860,7 @@ where
key: Among<&'a [u8], &'b [u8], &'b K>,
) -> bool
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let nd_key = self
.arena
Expand Down Expand Up @@ -922,7 +922,7 @@ where
upsert: bool,
) -> Result<UpdateOk<'a, K, V, C, A, R>, Among<K::Error, E, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let is_remove = key.is_remove();
// Safety: a fresh new Inserter, so safe here
Expand Down Expand Up @@ -1329,7 +1329,7 @@ where
other: Either<&'a [u8], &K::Ref<'a>>,
) -> cmp::Ordering
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
match this {
Among::Right(key) => match other {
Expand Down
44 changes: 22 additions & 22 deletions src/generic/list/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,58 +170,58 @@ where
/// This method will return `false` if the entry is marked as removed. If you want to check if the key exists even if it is marked as removed,
/// you can use [`contains_key_with_tombstone`](SkipList::contains_key_with_tombstone).
#[inline]
pub fn contains_key<Q>(&self, version: Version, key: &Q) -> bool
pub fn contains_key<'a, Q>(&'a self, version: Version, key: &Q) -> bool
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.get(version, key).is_some()
}

/// Returns `true` if the key exists in the map, even if it is marked as removed.
#[inline]
pub fn contains_key_with_tombstone<Q>(&self, version: Version, key: &Q) -> bool
pub fn contains_key_with_tombstone<'a, Q>(&'a self, version: Version, key: &Q) -> bool
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.get_with_tombstone(version, key).is_some()
}

/// Returns the first entry in the map.
pub fn first(&self, version: Version) -> Option<EntryRef<'_, K, V, Active, C, A, RC>>
pub fn first<'a>(&'a self, version: Version) -> Option<EntryRef<'a, K, V, Active, C, A, RC>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self.iter(version).next()
}

/// Returns the last entry in the map.
pub fn last(&self, version: Version) -> Option<EntryRef<'_, K, V, Active, C, A, RC>>
pub fn last<'a>(&'a self, version: Version) -> Option<EntryRef<'a, K, V, Active, C, A, RC>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self.iter(version).last()
}

/// Returns the first entry in the map.
pub fn first_with_tombstone(
&self,
pub fn first_with_tombstone<'a>(
&'a self,
version: Version,
) -> Option<EntryRef<'_, K, V, MaybeTombstone, C, A, RC>>
) -> Option<EntryRef<'a, K, V, MaybeTombstone, C, A, RC>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self.iter_all(version).next()
}

/// Returns the last entry in the map.
pub fn last_with_tombstone(
&self,
pub fn last_with_tombstone<'a>(
&'a self,
version: Version,
) -> Option<EntryRef<'_, K, V, MaybeTombstone, C, A, RC>>
) -> Option<EntryRef<'a, K, V, MaybeTombstone, C, A, RC>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self.iter_all(version).last()
}
Expand All @@ -237,7 +237,7 @@ where
) -> Option<EntryRef<'a, K, V, Active, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
unsafe {
let (n, eq) = self.find_near(version, key, false, true); // findLessOrEqual.
Expand Down Expand Up @@ -283,7 +283,7 @@ where
) -> Option<EntryRef<'a, K, V, MaybeTombstone, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
unsafe {
let (n, eq) = self.find_near(version, key, false, true); // findLessOrEqual.
Expand Down Expand Up @@ -331,7 +331,7 @@ where
) -> Option<EntryRef<'a, K, V, Active, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.iter(version).seek_upper_bound(upper)
}
Expand All @@ -345,7 +345,7 @@ where
) -> Option<EntryRef<'a, K, V, Active, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.iter(version).seek_lower_bound(lower)
}
Expand All @@ -359,7 +359,7 @@ where
) -> Option<EntryRef<'a, K, V, MaybeTombstone, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.iter_all(version).seek_upper_bound(upper)
}
Expand All @@ -373,7 +373,7 @@ where
) -> Option<EntryRef<'a, K, V, MaybeTombstone, C, A, RC>>
where
Q: ?Sized,
C: TypeRefQueryComparator<K, Q>,
C: TypeRefQueryComparator<'a, K, Q>,
{
self.iter_all(version).seek_lower_bound(lower)
}
Expand Down
20 changes: 10 additions & 10 deletions src/generic/list/api/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
value: impl Into<MaybeStructured<'b, V>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<K::Error, V::Error, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self.insert_at_height(version, self.random_height(), key, value)
}
Expand All @@ -53,7 +53,7 @@ where
value: impl Into<MaybeStructured<'b, V>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<K::Error, V::Error, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
let value: MaybeStructured<'_, V> = value.into();
Expand Down Expand Up @@ -107,7 +107,7 @@ where
value_builder: ValueBuilder<impl FnOnce(&mut VacantBuffer<'a>) -> Result<usize, E>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<K::Error, E, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
self
Expand Down Expand Up @@ -150,7 +150,7 @@ where
value: impl Into<MaybeStructured<'b, V>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<K::Error, V::Error, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
let value: MaybeStructured<'_, V> = value.into();
Expand Down Expand Up @@ -204,7 +204,7 @@ where
value_builder: ValueBuilder<impl FnOnce(&mut VacantBuffer<'a>) -> Result<usize, E>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<K::Error, E, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
self
Expand Down Expand Up @@ -252,7 +252,7 @@ where
value_builder: ValueBuilder<impl FnOnce(&mut VacantBuffer<'a>) -> Result<usize, VE>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<KE, VE, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self
.validate(height, key_builder.size(), value_builder.size())
Expand Down Expand Up @@ -308,7 +308,7 @@ where
value_builder: ValueBuilder<impl FnOnce(&mut VacantBuffer<'a>) -> Result<usize, VE>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Among<KE, VE, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self
.validate(height, key_builder.size(), value_builder.size())
Expand Down Expand Up @@ -365,7 +365,7 @@ where
failure: Ordering,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Either<K::Error, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
self
Expand Down Expand Up @@ -418,7 +418,7 @@ where
key: impl Into<MaybeStructured<'b, K>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Either<K::Error, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
let key: MaybeStructured<'_, K> = key.into();
self
Expand Down Expand Up @@ -470,7 +470,7 @@ where
key_builder: KeyBuilder<impl FnOnce(&mut VacantBuffer<'a>) -> Result<usize, E>>,
) -> Result<Option<EntryRef<'a, K, V, Active, C, A, R>>, Either<E, Error>>
where
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
self
.validate(height, key_builder.size(), 0)
Expand Down
8 changes: 4 additions & 4 deletions src/generic/list/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where
where
S::Data<'a, LazyRef<'a, V>>: Transformable,
{
!self.value.validate()
!S::validate_data(&self.value)
}
}

Expand All @@ -153,18 +153,18 @@ where
S::Data<'a, LazyRef<'a, V>>: Sized + Transformable<Input = Option<&'a [u8]>>,
A: Allocator,
R: RefCounter,
C: TypeRefComparator<K>,
C: TypeRefComparator<'a, K>,
{
/// Returns the next entry in the map.
#[inline]
pub fn next(&self) -> Option<Self> {
self.next_in(<S::Data<'a, LazyRef<'a, V>> as Transformable>::always_valid())
self.next_in(S::ALWAYS_VALID)
}

/// Returns the previous entry in the map.
#[inline]
pub fn prev(&self) -> Option<Self> {
self.prev_in(<S::Data<'a, LazyRef<'a, V>> as Transformable>::always_valid())
self.prev_in(S::ALWAYS_VALID)
}

fn next_in(&self, always_valid: bool) -> Option<Self> {
Expand Down
Loading

0 comments on commit b081c3d

Please sign in to comment.