Skip to main content

ChangeSetReader

Trait ChangeSetReader 

Source
pub trait ChangeSetReader {
    // Required methods
    fn account_block_changeset(
        &self,
        block_number: u64,
    ) -> Result<Vec<AccountBeforeTx>, ProviderError>;
    fn get_account_before_block(
        &self,
        block_number: u64,
        address: Address,
    ) -> Result<Option<AccountBeforeTx>, ProviderError>;
    fn account_changesets_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<(u64, AccountBeforeTx)>, ProviderError>;

    // Provided methods
    fn for_each_account_changeset(
        &self,
        range: impl RangeBounds<u64>,
        f: impl FnMut(u64, AccountBeforeTx),
    ) -> Result<(), ProviderError> { ... }
    fn lowest_account_changeset_block(
        &self,
    ) -> Result<Option<u64>, ProviderError> { ... }
}
Available on crate feature provider only.
Expand description

AccountChange reader

Required Methods§

Source

fn account_block_changeset( &self, block_number: u64, ) -> Result<Vec<AccountBeforeTx>, ProviderError>

Iterate over account changesets and return the account state from before this block.

Source

fn get_account_before_block( &self, block_number: u64, address: Address, ) -> Result<Option<AccountBeforeTx>, ProviderError>

Search the block’s changesets for the given address, and return the result.

Returns None if the account was not changed in this block.

Source

fn account_changesets_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<(u64, AccountBeforeTx)>, ProviderError>

Get all account changesets in a range of blocks.

Accepts any range type that implements RangeBounds<BlockNumber>, including:

  • Range<BlockNumber> (e.g., 0..100)
  • RangeInclusive<BlockNumber> (e.g., 0..=99)
  • RangeFrom<BlockNumber> (e.g., 0..) - iterates until exhausted

If there is no start bound, 0 is used as the start block.

Returns a vector of (block_number, changeset) pairs.

Provided Methods§

Source

fn for_each_account_changeset( &self, range: impl RangeBounds<u64>, f: impl FnMut(u64, AccountBeforeTx), ) -> Result<(), ProviderError>

Calls f for every account changeset in a range of blocks, in block order.

This reads the same rows as Self::account_changesets_range, but implementations can stream them instead of collecting them. The default implementation collects the range.

Source

fn lowest_account_changeset_block(&self) -> Result<Option<u64>, ProviderError>

Returns the first block of the lowest stored account changeset file, if it is above genesis.

No account changesets are stored below this block even when no prune checkpoint exists, for example on a node bootstrapped from a snapshot without changesets from genesis. The block itself may be an empty pruned anchor, so callers treat it like a prune checkpoint. None means changesets may reach genesis, or this provider can’t tell.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T> ChangeSetReader for &'a T
where T: 'a + ChangeSetReader + ?Sized,

Source§

impl<T> ChangeSetReader for Arc<T>
where T: ChangeSetReader + ?Sized,

Source§

impl<T> ChangeSetReader for Box<T>
where T: ChangeSetReader + ?Sized,

Implementors§

Source§

impl<C, N> ChangeSetReader for NoopProvider<C, N>
where C: Send + Sync, N: NodePrimitives,

Source§

impl<N> ChangeSetReader for BlockchainProvider<N>

Source§

impl<N> ChangeSetReader for StaticFileProvider<N>
where N: NodePrimitives,

Source§

impl<T, ChainSpec> ChangeSetReader for MockEthProvider<T, ChainSpec>
where T: NodePrimitives, ChainSpec: Send + Sync,

Source§

impl<TX, N> ChangeSetReader for DatabaseProvider<TX, N>
where TX: DbTx, N: NodeTypes,