Skip to content

Commit

Permalink
Make trie-cache resettable from backend (paritytech#14516)
Browse files Browse the repository at this point in the history
* Add ability to reset trie-cache

* comment

* Update client/db/src/lib.rs

Co-authored-by: Bastian Köcher <[email protected]>

---------

Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
skunert and bkchr authored Jul 18, 2023
1 parent cfe2432 commit 839cf0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,13 @@ impl<Block: BlockT> Backend<Block> {
Self::from_database(db as Arc<_>, canonicalization_delay, &db_config, needs_init)
}

/// Reset the shared trie cache.
pub fn reset_trie_cache(&self) {
if let Some(cache) = &self.shared_trie_cache {
cache.reset();
}
}

/// Create new memory-backed client backend for tests.
#[cfg(any(test, feature = "test-helpers"))]
pub fn new_test(blocks_pruning: u32, canonicalization_delay: u64) -> Self {
Expand Down

0 comments on commit 839cf0c

Please sign in to comment.