Storage tracing (#3614)

* Storage tracing

* Whitepsaces

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Apply suggestions from code review

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

* Update Cargo.lock
This commit is contained in:
Arkadiy Paronyan
2019-09-17 20:42:15 +02:00
committed by GitHub
parent 2b040fe983
commit a07e567fe1
12 changed files with 223 additions and 41 deletions
+6
View File
@@ -110,6 +110,12 @@ impl<B: BlockT> Drop for RefTrackingState<B> {
}
}
impl<Block: BlockT> std::fmt::Debug for RefTrackingState<Block> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Block {:?}", self.parent_hash)
}
}
impl<B: BlockT> StateBackend<Blake2Hasher> for RefTrackingState<B> {
type Error = <DbState as StateBackend<Blake2Hasher>>::Error;
type Transaction = <DbState as StateBackend<Blake2Hasher>>::Transaction;
@@ -285,6 +285,12 @@ pub struct CachingState<H: Hasher, S: StateBackend<H>, B: BlockT> {
pub cache: CacheChanges<H, B>
}
impl<H: Hasher, S: StateBackend<H>, B: BlockT> std::fmt::Debug for CachingState<H, S, B> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Block {:?}", self.cache.parent_hash)
}
}
impl<H: Hasher, B: BlockT> CacheChanges<H, B> {
/// Propagate local cache into the shared cache and synchronize
/// the shared cache with the best block state.
@@ -325,6 +325,15 @@ where
}
}
impl<H: Hasher> std::fmt::Debug for GenesisOrUnavailableState<H> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match *self {
GenesisOrUnavailableState::Genesis(ref state) => state.fmt(f),
GenesisOrUnavailableState::Unavailable => write!(f, "Unavailable"),
}
}
}
impl<H: Hasher> StateBackend<H> for GenesisOrUnavailableState<H>
where
H::Out: Ord,