Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.0 #123

Merged
merged 21 commits into from
Feb 8, 2025
Merged

2.6.0 #123

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adjust for changes in lsm-tree
marvin-j97 committed Jan 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5f23be917605c22a797c3c52da5bbfc60b5bcb7d
28 changes: 18 additions & 10 deletions src/partition/mod.rs
Original file line number Diff line number Diff line change
@@ -335,23 +335,29 @@ impl PartitionHandle {
/// ```
#[must_use]
pub fn iter(&self) -> impl DoubleEndedIterator<Item = crate::Result<KvPair>> + 'static {
self.tree.iter().map(|item| item.map_err(Into::into))
self.tree
.iter(None, None)
.map(|item| item.map_err(Into::into))
}

/// Returns an iterator that scans through the entire partition, returning only keys.
///
/// Avoid using this function, or limit it as otherwise it may scan a lot of items.
#[must_use]
pub fn keys(&self) -> impl DoubleEndedIterator<Item = crate::Result<UserKey>> + 'static {
self.tree.keys().map(|item| item.map_err(Into::into))
self.tree
.keys(None, None)
.map(|item| item.map_err(Into::into))
}

/// Returns an iterator that scans through the entire partition, returning only values.
///
/// Avoid using this function, or limit it as otherwise it may scan a lot of items.
#[must_use]
pub fn values(&self) -> impl DoubleEndedIterator<Item = crate::Result<UserValue>> + 'static {
self.tree.values().map(|item| item.map_err(Into::into))
self.tree
.values(None, None)
.map(|item| item.map_err(Into::into))
}

/// Returns an iterator over a range of items.
@@ -377,7 +383,9 @@ impl PartitionHandle {
&'a self,
range: R,
) -> impl DoubleEndedIterator<Item = crate::Result<KvPair>> + 'static {
self.tree.range(range).map(|item| item.map_err(Into::into))
self.tree
.range(range, None, None)
.map(|item| item.map_err(Into::into))
}

/// Returns an iterator over a prefixed set of items.
@@ -404,7 +412,7 @@ impl PartitionHandle {
prefix: K,
) -> impl DoubleEndedIterator<Item = crate::Result<KvPair>> + 'static {
self.tree
.prefix(prefix)
.prefix(prefix, None, None)
.map(|item| item.map_err(Into::into))
}

@@ -532,7 +540,7 @@ impl PartitionHandle {
///
/// Will return `Err` if an IO error occurs.
pub fn contains_key<K: AsRef<[u8]>>(&self, key: K) -> crate::Result<bool> {
self.tree.contains_key(key).map_err(Into::into)
self.tree.contains_key(key, None).map_err(Into::into)
}

/// Retrieves an item from the partition.
@@ -557,7 +565,7 @@ impl PartitionHandle {
///
/// Will return `Err` if an IO error occurs.
pub fn get<K: AsRef<[u8]>>(&self, key: K) -> crate::Result<Option<lsm_tree::UserValue>> {
Ok(self.tree.get(key)?)
Ok(self.tree.get(key, None)?)
}

/// Retrieves the size of an item from the partition.
@@ -582,7 +590,7 @@ impl PartitionHandle {
///
/// Will return `Err` if an IO error occurs.
pub fn size_of<K: AsRef<[u8]>>(&self, key: K) -> crate::Result<Option<u32>> {
Ok(self.tree.size_of(key)?)
Ok(self.tree.size_of(key, None)?)
}

/// Returns the first key-value pair in the partition.
@@ -610,7 +618,7 @@ impl PartitionHandle {
///
/// Will return `Err` if an IO error occurs.
pub fn first_key_value(&self) -> crate::Result<Option<KvPair>> {
Ok(self.tree.first_key_value()?)
Ok(self.tree.first_key_value(None, None)?)
}

/// Returns the last key-value pair in the partition.
@@ -638,7 +646,7 @@ impl PartitionHandle {
///
/// Will return `Err` if an IO error occurs.
pub fn last_key_value(&self) -> crate::Result<Option<KvPair>> {
Ok(self.tree.last_key_value()?)
Ok(self.tree.last_key_value(None, None)?)
}

// NOTE: Used in tests
10 changes: 5 additions & 5 deletions src/tx/read_tx.rs
Original file line number Diff line number Diff line change
@@ -292,7 +292,7 @@ impl ReadTransaction {
let iter = partition
.inner
.tree
.iter_with_seqno(self.nonce.instant, None)
.iter(Some(self.nonce.instant), None)
.map(|item| Ok(item?));

crate::iter::Iter::new(self.nonce.clone(), iter)
@@ -309,7 +309,7 @@ impl ReadTransaction {
let iter = partition
.inner
.tree
.keys_with_seqno(self.nonce.instant, None)
.keys(Some(self.nonce.instant), None)
.map(|item| Ok(item?));

crate::iter::Iter::new(self.nonce.clone(), iter)
@@ -326,7 +326,7 @@ impl ReadTransaction {
let iter = partition
.inner
.tree
.values_with_seqno(self.nonce.instant, None)
.values(Some(self.nonce.instant), None)
.map(|item| Ok(item?));

crate::iter::Iter::new(self.nonce.clone(), iter)
@@ -361,7 +361,7 @@ impl ReadTransaction {
let iter = partition
.inner
.tree
.range_with_seqno(range, self.nonce.instant, None)
.range(range, Some(self.nonce.instant), None)
.map(|item| Ok(item?));

crate::iter::Iter::new(self.nonce.clone(), iter)
@@ -396,7 +396,7 @@ impl ReadTransaction {
let iter = partition
.inner
.tree
.prefix_with_seqno(prefix, self.nonce.instant, None)
.prefix(prefix, Some(self.nonce.instant), None)
.map(|item| Ok(item?));

crate::iter::Iter::new(self.nonce.clone(), iter)
16 changes: 8 additions & 8 deletions src/tx/write/mod.rs
Original file line number Diff line number Diff line change
@@ -265,8 +265,8 @@ impl BaseTransaction {
partition
.inner
.tree
.iter_with_seqno(
self.nonce.instant,
.iter(
Some(self.nonce.instant),
self.memtables.get(&partition.inner.name).cloned(),
)
.map(|item| item.map_err(Into::into))
@@ -283,7 +283,7 @@ impl BaseTransaction {
partition
.inner
.tree
.keys_with_seqno(self.nonce.instant, None)
.keys(Some(self.nonce.instant), None)
.map(|item| item.map_err(Into::into))
}

@@ -298,7 +298,7 @@ impl BaseTransaction {
partition
.inner
.tree
.values_with_seqno(self.nonce.instant, None)
.values(Some(self.nonce.instant), None)
.map(|item| item.map_err(Into::into))
}

@@ -314,9 +314,9 @@ impl BaseTransaction {
partition
.inner
.tree
.range_with_seqno(
.range(
range,
self.nonce.instant,
Some(self.nonce.instant),
self.memtables.get(&partition.inner.name).cloned(),
)
.map(|item| item.map_err(Into::into))
@@ -334,9 +334,9 @@ impl BaseTransaction {
partition
.inner
.tree
.prefix_with_seqno(
.prefix(
prefix,
self.nonce.instant,
Some(self.nonce.instant),
self.memtables.get(&partition.inner.name).cloned(),
)
.map(|item| item.map_err(Into::into))