-
Notifications
You must be signed in to change notification settings - Fork 24
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
Storage: remove get_range
#359
Changes from 3 commits
7200dc0
72c9db3
9475f3f
a916b00
cab3ecc
2d1880a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
//! Abstracted database table operations; `trait DatabaseRo` & `trait DatabaseRw`. | ||
|
||
//---------------------------------------------------------------------------------------------------- Import | ||
use std::ops::RangeBounds; | ||
|
||
use crate::{ | ||
error::{DbResult, RuntimeError}, | ||
table::Table, | ||
|
@@ -35,6 +33,9 @@ Each iteration of the iterator has the potential to error as well." | |
/// - <https://github.com/Cuprate/cuprate/pull/102#discussion_r1548695610> | ||
/// - <https://github.com/Cuprate/cuprate/pull/104> | ||
pub trait DatabaseIter<T: Table> { | ||
/* | ||
FIXME: <https://github.com/Cuprate/cuprate/issues/348> | ||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be worth leaving this as-is then where used in let tx_blobs = if cfg!(feature = "heed") {
(first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))
.map(|idx| {
let tx_blob = tables.tx_blobs().get(&idx)?.0;
Ok(Bytes::from(tx_blob))
})
.collect::<Result<_, RuntimeError>>()?
} else {
tables
.tx_blobs_iter()
.get_range(first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))?
.map(|tx_blob| Ok(Bytes::from(tx_blob?.0)))
.collect::<Result<_, RuntimeError>>()?
}; Or is it not that important for now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or actually, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I tried to do this but it's harder than it sounds. In
I don't think the complexity is worth it. This is only used for other nodes syncing from us, which from some initial tests, is still significantly faster than |
||
|
||
/// Get an [`Iterator`] of value's corresponding to a range of keys. | ||
/// | ||
/// For example: | ||
|
@@ -55,6 +56,8 @@ pub trait DatabaseIter<T: Table> { | |
where | ||
Range: RangeBounds<T::Key> + 'a; | ||
|
||
*/ | ||
|
||
/// Get an [`Iterator`] that returns the `(key, value)` types for this database. | ||
#[doc = doc_iter!()] | ||
#[expect(clippy::iter_not_returning_iterator)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a temporary fix right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be, yes