pub trait SnapBytecodeStore {
// Required methods
fn missing_code(
&self,
write: SnapWrite,
hashes: &[B256],
limit: usize,
) -> Result<Vec<B256>, SnapSyncError>
where Self: DBProvider;
fn commit_bytecodes(
&self,
write: SnapWrite,
codes: Vec<(B256, Bytes)>,
) -> Result<usize, SnapSyncError>
where Self: StateWriter + DBProvider<Tx: DbTxMut>;
}Expand description
Persistence for the code an attempt’s accounts reference.
Blanket-implemented over the node’s writers, so code joins the caller’s transaction and commits with whatever else that transaction carries.
Required Methods§
Sourcefn missing_code(
&self,
write: SnapWrite,
hashes: &[B256],
limit: usize,
) -> Result<Vec<B256>, SnapSyncError>where
Self: DBProvider,
fn missing_code(
&self,
write: SnapWrite,
hashes: &[B256],
limit: usize,
) -> Result<Vec<B256>, SnapSyncError>where
Self: DBProvider,
Returns the first limit of hashes that are not stored yet, so the scan a request costs
is bounded by what it can ask for.
Sourcefn commit_bytecodes(
&self,
write: SnapWrite,
codes: Vec<(B256, Bytes)>,
) -> Result<usize, SnapSyncError>where
Self: StateWriter + DBProvider<Tx: DbTxMut>,
fn commit_bytecodes(
&self,
write: SnapWrite,
codes: Vec<(B256, Bytes)>,
) -> Result<usize, SnapSyncError>where
Self: StateWriter + DBProvider<Tx: DbTxMut>,
Persists codes, each checked against the hash it was downloaded under, and returns how
many were written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".