mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Rework storage iterators (#13284)
* Rework storage iterators * Make sure storage iteration is also accounted for when benchmarking * Use `trie-db` from crates.io * Appease clippy * Bump `trie-bench` to 0.35.0 * Fix tests' compilation * Update comment to clarify how `IterArgs::start_at` works * Add extra tests * Fix iterators on `Client` so that they behave as before * Add extra `unwrap`s in tests * More clippy fixes * Come on clippy, give me a break already * Rename `allow_missing` to `stop_on_incomplete_database` * Add `#[inline]` to `with_recorder_and_cache` * Use `with_recorder_and_cache` in `with_trie_db`; add doc comment * Simplify code: use `with_trie_db` in `next_storage_key_from_root` * Remove `expect`s in the benchmarking CLI * Add extra doc comments * Move `RawIter` before `TrieBackendEssence` (no code changes; just cut-paste) * Remove a TODO in tests * Update comment for `StorageIterator::was_complete` * Update `trie-db` to 0.25.1
This commit is contained in:
+2
-2
@@ -438,8 +438,8 @@ enum ValueCache<'a, H: Hasher> {
|
||||
|
||||
impl<H: Hasher> ValueCache<'_, H> {
|
||||
/// Get the value for the given `key`.
|
||||
fn get<'a>(
|
||||
&'a mut self,
|
||||
fn get(
|
||||
&mut self,
|
||||
key: &[u8],
|
||||
shared_cache: &SharedTrieCache<H>,
|
||||
stats: &HitStats,
|
||||
|
||||
@@ -51,7 +51,7 @@ pub use trie_db::{
|
||||
nibble_ops,
|
||||
node::{NodePlan, ValuePlan},
|
||||
CError, DBValue, Query, Recorder, Trie, TrieCache, TrieConfiguration, TrieDBIterator,
|
||||
TrieDBKeyIterator, TrieLayout, TrieMut, TrieRecorder,
|
||||
TrieDBKeyIterator, TrieDBRawIterator, TrieLayout, TrieMut, TrieRecorder,
|
||||
};
|
||||
/// The Substrate format implementation of `TrieStream`.
|
||||
pub use trie_stream::TrieStream;
|
||||
@@ -442,6 +442,7 @@ fn keyspace_as_prefix_alloc(ks: &[u8], prefix: Prefix) -> (Vec<u8>, Option<u8>)
|
||||
|
||||
impl<'a, DB: ?Sized, H> KeySpacedDB<'a, DB, H> {
|
||||
/// instantiate new keyspaced db
|
||||
#[inline]
|
||||
pub fn new(db: &'a DB, ks: &'a [u8]) -> Self {
|
||||
KeySpacedDB(db, ks, PhantomData)
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ impl<H: Hasher> Recorder<H> {
|
||||
///
|
||||
/// - `storage_root`: The storage root of the trie for which accesses are recorded. This is
|
||||
/// important when recording access to different tries at once (like top and child tries).
|
||||
#[inline]
|
||||
pub fn as_trie_recorder(
|
||||
&self,
|
||||
storage_root: H::Out,
|
||||
@@ -147,7 +148,7 @@ struct TrieRecorder<H: Hasher, I> {
|
||||
impl<H: Hasher, I: DerefMut<Target = RecorderInner<H::Out>>> trie_db::TrieRecorder<H::Out>
|
||||
for TrieRecorder<H, I>
|
||||
{
|
||||
fn record<'b>(&mut self, access: TrieAccess<'b, H::Out>) {
|
||||
fn record(&mut self, access: TrieAccess<H::Out>) {
|
||||
let mut encoded_size_update = 0;
|
||||
|
||||
match access {
|
||||
|
||||
Reference in New Issue
Block a user