pub struct JournalEntry {
pub block_hash: H256,
pub parent_state_root: H256,
pub account_trie_diff: FlatDiff,
pub storage_trie_diff: FlatDiff,
pub account_flat_diff: FlatDiff,
pub storage_flat_diff: FlatDiff,
}Expand description
A single reverse-diff entry covering one block’s commit.
All four diff sections are flat lists of (on_disk_key, prev_value) tuples.
On rollback, each entry can be applied directly to its column family
without further interpretation: Some(prev) becomes a put, None
becomes a delete.
Fields§
§block_hash: H256Hash of the block whose commit this entry reverses.
parent_state_root: H256Post-state root of the parent block (the state we’d return to on rollback).
account_trie_diff: FlatDiffReverse diff for ACCOUNT_TRIE_NODES.
storage_trie_diff: FlatDiffReverse diff for STORAGE_TRIE_NODES. Keys carry the nibble-encoded
account-hash prefix as written on disk; no separate grouping is needed.
account_flat_diff: FlatDiffReverse diff for ACCOUNT_FLATKEYVALUE.
storage_flat_diff: FlatDiffReverse diff for STORAGE_FLATKEYVALUE. Keys carry the nibble-encoded
account-hash prefix as written on disk.
Implementations§
Source§impl JournalEntry
impl JournalEntry
Sourcepub fn decode_block_hash(bytes: &[u8]) -> Result<H256, JournalDecodeError>
pub fn decode_block_hash(bytes: &[u8]) -> Result<H256, JournalDecodeError>
Read only the block hash of an entry: the version byte followed by the
32-byte hash at offset 1. Skips the reverse diffs, which can run to
megabytes for a state-heavy block, and does not depend on their
integrity. Rejects a foreign version byte like Self::decode.
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, JournalDecodeError>
pub fn decode(bytes: &[u8]) -> Result<Self, JournalDecodeError>
Decode an entry from its on-disk byte representation.
Returns JournalDecodeError::VersionMismatch if the version byte is
not JOURNAL_VERSION. The current binary deliberately refuses to
interpret entries written by a future codec version rather than silently
producing a malformed reverse-diff.
Trait Implementations§
Source§impl Clone for JournalEntry
impl Clone for JournalEntry
Source§impl Debug for JournalEntry
impl Debug for JournalEntry
impl Eq for JournalEntry
Source§impl PartialEq for JournalEntry
impl PartialEq for JournalEntry
impl StructuralPartialEq for JournalEntry
Auto Trait Implementations§
impl Freeze for JournalEntry
impl RefUnwindSafe for JournalEntry
impl Send for JournalEntry
impl Sync for JournalEntry
impl Unpin for JournalEntry
impl UnsafeUnpin for JournalEntry
impl UnwindSafe for JournalEntry
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.