pub struct StateDbGeneric { /* private fields */ }

Implementations§

source§

impl StateDb

source

pub fn new(storage: Box<dyn StorageStateTrait>) -> Self

source

pub fn delete( &mut self, key: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<()>

source

pub fn delete_all<AM: AccessMode>( &mut self, key_prefix: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<Vec<MptKeyValue>>

source

pub fn set_storage_layout( &mut self, address: &AddressWithSpace, storage_layout: StorageLayout, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<()>

source

pub fn compute_state_root( &mut self, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<StateRootWithAuxInfo>

This method is only used for genesis block because state root is required to compute genesis epoch_id. For other blocks there are deferred execution so the state root computation is merged inside commit method.

source

pub fn commit( &mut self, epoch_id: EpochId, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<StateRootWithAuxInfo>

Trait Implementations§

source§

impl StateDbExt for StateDbGeneric

source§

fn get<T>(&self, key: StorageKeyWithSpace<'_>) -> Result<Option<T>>
where T: Decodable,

source§

fn set<T>( &mut self, key: StorageKeyWithSpace<'_>, value: &T, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<()>
where T: Encodable + IsDefault,

source§

fn get_account(&self, address: &AddressWithSpace) -> Result<Option<Account>>

source§

fn get_code( &self, address: &AddressWithSpace, code_hash: &H256 ) -> Result<Option<CodeInfo>>

source§

fn get_deposit_list( &self, address: &AddressWithSpace ) -> Result<Option<DepositList>>

source§

fn get_vote_list( &self, address: &AddressWithSpace ) -> Result<Option<VoteStakeList>>

source§

fn get_global_param<T: GlobalParamKey>(&self) -> Result<U256>

source§

fn get_system_storage(&self, key: &[u8]) -> Result<U256>

source§

fn set_global_param<T: GlobalParamKey>( &mut self, value: &U256, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<()>

source§

fn is_initialized(&self) -> Result<bool>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ElementSatisfy<ElementNoConstrain> for T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V