pub trait SnapAccountStore {
// Required methods
fn start_account_coverage(
&self,
write: SnapWrite,
) -> Result<AccountCoverage, SnapSyncError>
where Self: MetadataWriter;
fn account_coverage(
&self,
write: SnapWrite,
) -> Result<Option<AccountCoverage>, SnapSyncError>;
fn commit_account_range(
&self,
write: SnapWrite,
range: &VerifiedAccountRange,
storages: B256Map<HashedStorage>,
bytecodes: Vec<(B256, Bytecode)>,
) -> Result<AccountCoverage, SnapSyncError>
where Self: MetadataWriter + StateWriter + DBProvider<Tx: DbTxMut>;
fn remove_storages_except(
&self,
interval: (Bound<B256>, Bound<B256>),
kept: &[B256],
) -> Result<(), SnapSyncError>
where Self: DBProvider<Tx: DbTxMut>;
fn snap_repairs(
&self,
write: SnapWrite,
) -> Result<StateRepairs, SnapSyncError>;
fn schedule_snap_repairs(
&self,
write: SnapWrite,
repairs: StateRepairs,
) -> Result<(), SnapSyncError>
where Self: MetadataWriter;
fn commit_account_repair(
&self,
write: SnapWrite,
range: &VerifiedAccountRange,
slots: Vec<(B256, U256)>,
) -> Result<usize, SnapSyncError>
where Self: BlockHashReader + MetadataWriter + StateWriter + DBProvider<Tx: DbTxMut>;
}Expand description
Persistence for the account ranges an attempt downloads.
Blanket-implemented over the node’s writers, so accounts, their dependencies and the coverage join the caller’s transaction and commit together or not at all.
Required Methods§
Sourcefn start_account_coverage(
&self,
write: SnapWrite,
) -> Result<AccountCoverage, SnapSyncError>where
Self: MetadataWriter,
fn start_account_coverage(
&self,
write: SnapWrite,
) -> Result<AccountCoverage, SnapSyncError>where
Self: MetadataWriter,
Returns the coverage recorded for the attempt write belongs to, recording that no
account has been downloaded yet when there is none.
Sourcefn account_coverage(
&self,
write: SnapWrite,
) -> Result<Option<AccountCoverage>, SnapSyncError>
fn account_coverage( &self, write: SnapWrite, ) -> Result<Option<AccountCoverage>, SnapSyncError>
Returns the coverage recorded for the attempt write belongs to, if any.
Sourcefn commit_account_range(
&self,
write: SnapWrite,
range: &VerifiedAccountRange,
storages: B256Map<HashedStorage>,
bytecodes: Vec<(B256, Bytecode)>,
) -> Result<AccountCoverage, SnapSyncError>
fn commit_account_range( &self, write: SnapWrite, range: &VerifiedAccountRange, storages: B256Map<HashedStorage>, bytecodes: Vec<(B256, Bytecode)>, ) -> Result<AccountCoverage, SnapSyncError>
Persists range with its storage and code, replacing its key interval.
Storage must match each account’s root, supplied or persisted ahead of the range by
SnapStorageStore, and code must be supplied or already stored. Persisted storage only
counts once catch-up has carried it to the pivot.
Sourcefn remove_storages_except(
&self,
interval: (Bound<B256>, Bound<B256>),
kept: &[B256],
) -> Result<(), SnapSyncError>where
Self: DBProvider<Tx: DbTxMut>,
fn remove_storages_except(
&self,
interval: (Bound<B256>, Bound<B256>),
kept: &[B256],
) -> Result<(), SnapSyncError>where
Self: DBProvider<Tx: DbTxMut>,
Removes storage in interval except the contracts in kept, which are sorted and inside
it.
Sourcefn snap_repairs(&self, write: SnapWrite) -> Result<StateRepairs, SnapSyncError>
fn snap_repairs(&self, write: SnapWrite) -> Result<StateRepairs, SnapSyncError>
Returns the repairs scheduled for the attempt write belongs to.
Sourcefn schedule_snap_repairs(
&self,
write: SnapWrite,
repairs: StateRepairs,
) -> Result<(), SnapSyncError>where
Self: MetadataWriter,
fn schedule_snap_repairs(
&self,
write: SnapWrite,
repairs: StateRepairs,
) -> Result<(), SnapSyncError>where
Self: MetadataWriter,
Adds repairs to those scheduled for the attempt write belongs to.
Sourcefn commit_account_repair(
&self,
write: SnapWrite,
range: &VerifiedAccountRange,
slots: Vec<(B256, U256)>,
) -> Result<usize, SnapSyncError>
fn commit_account_repair( &self, write: SnapWrite, range: &VerifiedAccountRange, slots: Vec<(B256, U256)>, ) -> Result<usize, SnapSyncError>
Writes the pivot’s account at range’s origin and its slots, returning how many accounts
remain scheduled. Refused until catch-up reaches the pivot.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".