mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 00:21:05 +00:00
Remove the dependency on heapsize (#2459)
* Remove heapsize dependency * Finish removing heapsize * Revert accidental change * Fix Cargo.lock
This commit is contained in:
committed by
Gavin Wood
parent
9fdd7df582
commit
5a820db7f5
@@ -27,7 +27,6 @@ use runtime_primitives::{Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use state_machine::backend::{Backend as StateBackend, InMemory, Consolidate};
|
||||
use state_machine::{self, InMemoryChangesTrieStorage, ChangesTrieAnchorBlockId};
|
||||
use hash_db::Hasher;
|
||||
use heapsize::HeapSizeOf;
|
||||
use trie::MemoryDB;
|
||||
use consensus::well_known_cache_keys::Id as CacheKeyId;
|
||||
|
||||
@@ -446,7 +445,7 @@ where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
type State = InMemory<H>;
|
||||
|
||||
@@ -532,7 +531,7 @@ pub struct Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
states: RwLock<HashMap<Block::Hash, InMemory<H>>>,
|
||||
changes_trie_storage: ChangesTrieStorage<H>,
|
||||
@@ -543,7 +542,7 @@ impl<Block, H> Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
/// Create a new instance of in-mem backend.
|
||||
pub fn new() -> Backend<Block, H> {
|
||||
@@ -559,7 +558,7 @@ impl<Block, H> backend::AuxStore for Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
fn insert_aux<
|
||||
'a,
|
||||
@@ -580,7 +579,7 @@ impl<Block, H> backend::Backend<Block, H> for Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
type BlockImportOperation = BlockImportOperation<Block, H>;
|
||||
type Blockchain = Blockchain<Block>;
|
||||
@@ -682,14 +681,14 @@ impl<Block, H> backend::LocalBackend<Block, H> for Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{}
|
||||
|
||||
impl<Block, H> backend::RemoteBackend<Block, H> for Backend<Block, H>
|
||||
where
|
||||
Block: BlockT,
|
||||
H: Hasher<Out=Block::Hash>,
|
||||
H::Out: HeapSizeOf + Ord,
|
||||
H::Out: Ord,
|
||||
{
|
||||
fn is_local_state_available(&self, block: &BlockId<Block>) -> bool {
|
||||
self.blockchain.expect_block_number_from_id(block)
|
||||
@@ -699,20 +698,20 @@ where
|
||||
}
|
||||
|
||||
/// Prunable in-memory changes trie storage.
|
||||
pub struct ChangesTrieStorage<H: Hasher>(InMemoryChangesTrieStorage<H>) where H::Out: HeapSizeOf;
|
||||
impl<H: Hasher> backend::PrunableStateChangesTrieStorage<H> for ChangesTrieStorage<H> where H::Out: HeapSizeOf {
|
||||
pub struct ChangesTrieStorage<H: Hasher>(InMemoryChangesTrieStorage<H>);
|
||||
impl<H: Hasher> backend::PrunableStateChangesTrieStorage<H> for ChangesTrieStorage<H> {
|
||||
fn oldest_changes_trie_block(&self, _config: &ChangesTrieConfiguration, _best_finalized: u64) -> u64 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: Hasher> state_machine::ChangesTrieRootsStorage<H> for ChangesTrieStorage<H> where H::Out: HeapSizeOf {
|
||||
impl<H: Hasher> state_machine::ChangesTrieRootsStorage<H> for ChangesTrieStorage<H> {
|
||||
fn root(&self, anchor: &ChangesTrieAnchorBlockId<H::Out>, block: u64) -> Result<Option<H::Out>, String> {
|
||||
self.0.root(anchor, block)
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: Hasher> state_machine::ChangesTrieStorage<H> for ChangesTrieStorage<H> where H::Out: HeapSizeOf {
|
||||
impl<H: Hasher> state_machine::ChangesTrieStorage<H> for ChangesTrieStorage<H> {
|
||||
fn get(&self, key: &H::Out, prefix: &[u8]) -> Result<Option<state_machine::DBValue>, String> {
|
||||
self.0.get(key, prefix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user