diff --git a/storage/database/src/backend/heed/database.rs b/storage/database/src/backend/heed/database.rs index c985d0de..6fbff7ac 100644 --- a/storage/database/src/backend/heed/database.rs +++ b/storage/database/src/backend/heed/database.rs @@ -1,7 +1,7 @@ //! Implementation of `trait Database` for `heed`. //---------------------------------------------------------------------------------------------------- Import -use std::{cell::RefCell, ops::RangeBounds}; +use std::cell::RefCell; use crate::{ backend::heed::types::HeedDb, @@ -96,6 +96,7 @@ fn is_empty( //---------------------------------------------------------------------------------------------------- DatabaseIter Impl impl DatabaseIter for HeedTableRo<'_, T> { + /* #[inline] fn get_range<'a, Range>( &'a self, @@ -107,6 +108,8 @@ impl DatabaseIter for HeedTableRo<'_, T> { Ok(self.db.range(self.tx_ro, &range)?.map(|res| Ok(res?.1))) } + */ + #[inline] fn iter( &self, diff --git a/storage/database/src/backend/redb/database.rs b/storage/database/src/backend/redb/database.rs index dafb2417..4f30425b 100644 --- a/storage/database/src/backend/redb/database.rs +++ b/storage/database/src/backend/redb/database.rs @@ -65,6 +65,7 @@ fn is_empty( //---------------------------------------------------------------------------------------------------- DatabaseIter impl DatabaseIter for RedbTableRo { + /* #[inline] fn get_range<'a, Range>( &'a self, @@ -79,6 +80,8 @@ impl DatabaseIter for RedbTableRo { })) } + */ + #[inline] fn iter( &self, diff --git a/storage/database/src/backend/redb/storable.rs b/storage/database/src/backend/redb/storable.rs index abf2e71b..f0412efb 100644 --- a/storage/database/src/backend/redb/storable.rs +++ b/storage/database/src/backend/redb/storable.rs @@ -34,8 +34,14 @@ impl redb::Value for StorableRedb where T: Storable + 'static, { - type SelfType<'a> = T where Self: 'a; - type AsBytes<'a> = &'a [u8] where Self: 'a; + type SelfType<'a> + = T + where + Self: 'a; + type AsBytes<'a> + = &'a [u8] + where + Self: 'a; #[inline] fn fixed_width() -> Option { diff --git a/storage/database/src/backend/tests.rs b/storage/database/src/backend/tests.rs index 0c0fe056..c06511cd 100644 --- a/storage/database/src/backend/tests.rs +++ b/storage/database/src/backend/tests.rs @@ -225,7 +225,7 @@ fn db_read_write() { // Assert the whole range is there. { - let range = table_ro.get_range(..).unwrap(); + let range = table_ro.values().unwrap(); let mut i = 0; for result in range { let value = result.unwrap(); @@ -241,14 +241,11 @@ fn db_read_write() { let range = KEY..key; // Assert count is correct. - assert_eq!( - N as usize, - table_ro.get_range(range.clone()).unwrap().count() - ); + assert_eq!(N as usize, table_ro.values().unwrap().count()); // Assert each returned value from the iterator is owned. { - let mut iter = table_ro.get_range(range.clone()).unwrap(); + let mut iter = table_ro.values().unwrap(); let value = iter.next().unwrap().unwrap(); // 1. take value out drop(iter); // 2. drop the `impl Iterator + 'a` assert_value(value); // 3. assert even without the iterator, the value is alive @@ -256,7 +253,7 @@ fn db_read_write() { // Assert each value is the same. { - let mut iter = table_ro.get_range(range).unwrap(); + let mut iter = table_ro.values().unwrap(); for _ in 0..N { let value = iter.next().unwrap().unwrap(); assert_value(value); diff --git a/storage/database/src/database.rs b/storage/database/src/database.rs index 6fbb7aaa..dbceb09a 100644 --- a/storage/database/src/database.rs +++ b/storage/database/src/database.rs @@ -1,8 +1,6 @@ //! Abstracted database table operations; `trait DatabaseRo` & `trait DatabaseRw`. //---------------------------------------------------------------------------------------------------- Import -use std::ops::RangeBounds; - use crate::{error::RuntimeError, table::Table}; //---------------------------------------------------------------------------------------------------- DatabaseIter @@ -32,6 +30,9 @@ Each iteration of the iterator has the potential to error as well." /// - /// - pub trait DatabaseIter { + /* + FIXME: + /// Get an [`Iterator`] of value's corresponding to a range of keys. /// /// For example: @@ -52,6 +53,8 @@ pub trait DatabaseIter { where Range: RangeBounds + 'a; + */ + /// Get an [`Iterator`] that returns the `(key, value)` types for this database. #[doc = doc_iter!()] #[expect(clippy::iter_not_returning_iterator)]