pub struct CanonicalInMemoryStateWriter<N: NodePrimitives = EthPrimitives> { /* private fields */ }Expand description
Creates a CanonicalInMemoryState and changes it: the blocks it tracks, its chain info, and
the notifications it sends.
A writer is created together with its state. Self::canonical_in_memory_state returns that
state, which can be cloned and is what everything but the owner of the writer reads. What is
written through the writer is read through the state and every clone of it.
A writer cannot be cloned and its methods take &mut self, so only its owner changes the
state through it. The constructors of CanonicalInMemoryState and its methods that change
it are still public.
Implementations§
Source§impl<N: NodePrimitives> CanonicalInMemoryStateWriter<N>
impl<N: NodePrimitives> CanonicalInMemoryStateWriter<N>
Sourcepub fn new(
chain_info_headers: ChainInfoHeaders<N::BlockHeader>,
in_memory_state: InMemoryState<N>,
) -> Self
pub fn new( chain_info_headers: ChainInfoHeaders<N::BlockHeader>, in_memory_state: InMemoryState<N>, ) -> Self
Creates a canonical state over the blocks of in_memory_state, with the canonical head
and the safe and finalized blocks of chain_info_headers, and returns its writer.
The blocks are shared with every other handle of in_memory_state. The chain info and the
notifications belong to the created state and its clones.
Sourcepub const fn canonical_in_memory_state(&self) -> &CanonicalInMemoryState<N>
pub const fn canonical_in_memory_state(&self) -> &CanonicalInMemoryState<N>
Returns the state this changes.
Sourcepub fn clear_state(&mut self)
pub fn clear_state(&mut self)
Sourcepub fn insert_executed(&mut self, block: ExecutedBlock<N>)
pub fn insert_executed(&mut self, block: ExecutedBlock<N>)
Sourcepub fn set_pending_block(&mut self, pending: ExecutedBlock<N>)
pub fn set_pending_block(&mut self, pending: ExecutedBlock<N>)
Sourcepub fn update_chain(&mut self, new_chain: NewCanonicalChain<N>)
pub fn update_chain(&mut self, new_chain: NewCanonicalChain<N>)
Sourcepub fn on_backfill_finished(
&mut self,
last_persisted_hash: B256,
backfill_block: BlockNumHash,
)
pub fn on_backfill_finished( &mut self, last_persisted_hash: B256, backfill_block: BlockNumHash, )
Sourcepub fn on_blocks_persisted(
&mut self,
last_persisted_block: BlockNumHash,
state_trie_persisted_block: BlockNumHash,
finalized: Option<BlockNumHash>,
)
pub fn on_blocks_persisted( &mut self, last_persisted_block: BlockNumHash, state_trie_persisted_block: BlockNumHash, finalized: Option<BlockNumHash>, )
Sourcepub fn on_forkchoice_update_received(&mut self)
pub fn on_forkchoice_update_received(&mut self)
Sourcepub fn set_canonical_head(&mut self, header: SealedHeader<N::BlockHeader>)
pub fn set_canonical_head(&mut self, header: SealedHeader<N::BlockHeader>)
Sourcepub fn set_finalized(&mut self, header: SealedHeader<N::BlockHeader>)
pub fn set_finalized(&mut self, header: SealedHeader<N::BlockHeader>)
Sourcepub fn notify_canon_state(&mut self, event: CanonStateNotification<N>)
pub fn notify_canon_state(&mut self, event: CanonStateNotification<N>)
Trait Implementations§
Auto Trait Implementations§
impl<N = EthPrimitives> !RefUnwindSafe for CanonicalInMemoryStateWriter<N>
impl<N = EthPrimitives> !UnwindSafe for CanonicalInMemoryStateWriter<N>
impl<N> Forget for CanonicalInMemoryStateWriter<N>
impl<N> Freeze for CanonicalInMemoryStateWriter<N>where
CanonicalInMemoryState<N>: Freeze,
impl<N> Move for CanonicalInMemoryStateWriter<N>
impl<N> Send for CanonicalInMemoryStateWriter<N>where
CanonicalInMemoryState<N>: Send,
impl<N> Sync for CanonicalInMemoryStateWriter<N>where
CanonicalInMemoryState<N>: Sync,
impl<N> Unpin for CanonicalInMemoryStateWriter<N>where
CanonicalInMemoryState<N>: Unpin,
impl<N> UnsafeUnpin for CanonicalInMemoryStateWriter<N>where
CanonicalInMemoryState<N>: UnsafeUnpin,
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreimpl<T> MaybeDebug for Twhere
T: Debug,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes