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> { ... }
}storage-api only.Expand description
AccountChange reader
Required Methods§
Sourcefn account_block_changeset(
&self,
block_number: u64,
) -> Result<Vec<AccountBeforeTx>, ProviderError>
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.
Sourcefn get_account_before_block(
&self,
block_number: u64,
address: Address,
) -> Result<Option<AccountBeforeTx>, ProviderError>
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.
Sourcefn account_changesets_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<(u64, AccountBeforeTx)>, ProviderError>
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§
Sourcefn for_each_account_changeset(
&self,
range: impl RangeBounds<u64>,
f: impl FnMut(u64, AccountBeforeTx),
) -> Result<(), ProviderError>
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.
Sourcefn lowest_account_changeset_block(&self) -> Result<Option<u64>, ProviderError>
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".