pub trait StateWriter {
type Receipt: 'static;
// Required methods
fn write_state<'a>(
&self,
execution_outcome: impl Into<WriteStateInput<'a, Self::Receipt>>,
is_value_known: OriginalValuesKnown,
config: StateWriteConfig,
) -> Result<(), ProviderError>;
fn write_state_reverts(
&self,
reverts: PlainStateReverts,
first_block: u64,
config: StateWriteConfig,
) -> Result<(), ProviderError>;
fn write_state_changes(
&self,
changes: StateChangeset,
) -> Result<(), ProviderError>;
fn write_hashed_state(
&self,
hashed_state: &HashedPostStateSorted,
) -> Result<(), ProviderError>;
fn remove_state_above(&self, block: u64) -> Result<(), ProviderError>;
fn take_state_above(
&self,
block: u64,
) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>;
}storage-api only.Expand description
A trait specifically for writing state changes or reverts
Required Associated Types§
Sourcetype Receipt: 'static
type Receipt: 'static
Receipt type included into ExecutionOutcome.
Required Methods§
Sourcefn write_state<'a>(
&self,
execution_outcome: impl Into<WriteStateInput<'a, Self::Receipt>>,
is_value_known: OriginalValuesKnown,
config: StateWriteConfig,
) -> Result<(), ProviderError>
fn write_state<'a>( &self, execution_outcome: impl Into<WriteStateInput<'a, Self::Receipt>>, is_value_known: OriginalValuesKnown, config: StateWriteConfig, ) -> Result<(), ProviderError>
Write the state and optionally receipts to the database.
Use config to skip writing certain data types when they are written elsewhere.
Sourcefn write_state_reverts(
&self,
reverts: PlainStateReverts,
first_block: u64,
config: StateWriteConfig,
) -> Result<(), ProviderError>
fn write_state_reverts( &self, reverts: PlainStateReverts, first_block: u64, config: StateWriteConfig, ) -> Result<(), ProviderError>
Write state reverts to the database.
NOTE: Reverts will delete all wiped storage from plain state.
Use config to skip writing certain data types when they are written elsewhere.
Sourcefn write_state_changes(
&self,
changes: StateChangeset,
) -> Result<(), ProviderError>
fn write_state_changes( &self, changes: StateChangeset, ) -> Result<(), ProviderError>
Write state changes to the database.
Sourcefn write_hashed_state(
&self,
hashed_state: &HashedPostStateSorted,
) -> Result<(), ProviderError>
fn write_hashed_state( &self, hashed_state: &HashedPostStateSorted, ) -> Result<(), ProviderError>
Writes the hashed state changes to the database
Sourcefn remove_state_above(&self, block: u64) -> Result<(), ProviderError>
fn remove_state_above(&self, block: u64) -> Result<(), ProviderError>
Remove the block range of state above the given block. The state of the passed block is not removed.
Sourcefn take_state_above(
&self,
block: u64,
) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>
fn take_state_above( &self, block: u64, ) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>
Take the block range of state, recreating the ExecutionOutcome. The state of the passed
block is not removed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.