Storage chains: indexing, renewals and reference counting (#8265)

* Transaction indexing

* Tests and fixes

* Fixed a comment

* Style

* Build

* Style

* Apply suggestions from code review

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Code review suggestions

* Add missing impl

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* impl JoinInput

* Don't store empty slices

* JoinInput operates on slices

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Arkadiy Paronyan
2021-03-18 12:46:27 +01:00
committed by GitHub
parent f69f79cc20
commit 4a0d6d9490
22 changed files with 600 additions and 246 deletions
+31 -1
View File
@@ -18,7 +18,7 @@
//! Concrete externalities implementation.
use crate::{
StorageKey, StorageValue, OverlayedChanges,
StorageKey, StorageValue, OverlayedChanges, IndexOperation,
backend::Backend, overlayed_changes::OverlayedExtensions,
};
use hash_db::Hasher;
@@ -568,6 +568,36 @@ where
}
}
fn storage_index_transaction(&mut self, index: u32, offset: u32) {
trace!(
target: "state",
"{:04x}: IndexTransaction ({}): [{}..]",
self.id,
index,
offset,
);
self.overlay.add_transaction_index(IndexOperation::Insert {
extrinsic: index,
offset,
});
}
/// Renew existing piece of data storage.
fn storage_renew_transaction_index(&mut self, index: u32, hash: &[u8], size: u32) {
trace!(
target: "state",
"{:04x}: RenewTransactionIndex ({}) {} bytes",
self.id,
HexDisplay::from(&hash),
size,
);
self.overlay.add_transaction_index(IndexOperation::Renew {
extrinsic: index,
hash: hash.to_vec(),
size
});
}
#[cfg(not(feature = "std"))]
fn storage_changes_root(&mut self, _parent_hash: &[u8]) -> Result<Option<Vec<u8>>, ()> {
Ok(None)