pub struct StateDbGeneric { /* private fields */ }Implementations§
Source§impl StateDb
impl StateDb
pub fn new(storage: Box<dyn StorageStateTrait>) -> Self
pub fn delete( &mut self, key: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<()>
pub fn read_all( &mut self, key_prefix: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<Vec<MptKeyValue>>
pub fn read_all_with_callback( &mut self, access_key_prefix: StorageKeyWithSpace<'_>, callback: &mut dyn FnMut(MptKeyValue), only_account_key: bool, ) -> Result<()>
pub fn delete_all<AM: AccessMode>( &mut self, key_prefix: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<Vec<MptKeyValue>>
pub fn get_account_storage_entries( &mut self, address: &AddressWithSpace, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<BTreeMap<StorageKey, StorageValue>>
pub fn set_storage_layout( &mut self, address: &AddressWithSpace, storage_layout: StorageLayout, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<()>
Sourcepub fn compute_state_root(
&mut self,
debug_record: Option<&mut ComputeEpochDebugRecord>,
) -> Result<StateRootWithAuxInfo>
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.
pub fn commit( &mut self, epoch_id: EpochId, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<StateRootWithAuxInfo>
Trait Implementations§
Source§impl StateDbExt for StateDbGeneric
impl StateDbExt for StateDbGeneric
fn get<T>(&self, key: StorageKeyWithSpace<'_>) -> Result<Option<T>>where
T: Decodable,
fn set<T>(
&mut self,
key: StorageKeyWithSpace<'_>,
value: &T,
debug_record: Option<&mut ComputeEpochDebugRecord>,
) -> Result<()>where
T: Encodable + IsDefault,
fn get_account(&self, address: &AddressWithSpace) -> Result<Option<Account>>
fn get_code( &self, address: &AddressWithSpace, code_hash: &H256, ) -> Result<Option<CodeInfo>>
fn get_deposit_list( &self, address: &AddressWithSpace, ) -> Result<Option<DepositList>>
fn get_vote_list( &self, address: &AddressWithSpace, ) -> Result<Option<VoteStakeList>>
fn get_global_param<T: GlobalParamKey>(&self) -> Result<U256>
fn get_system_storage(&self, key: &[u8]) -> Result<U256>
fn set_global_param<T: GlobalParamKey>( &mut self, value: &U256, debug_record: Option<&mut ComputeEpochDebugRecord>, ) -> Result<()>
fn is_initialized(&self) -> Result<bool>
Auto Trait Implementations§
impl !Freeze for StateDb
impl !RefUnwindSafe for StateDb
impl !UnwindSafe for StateDb
impl Forget for StateDb
impl Move for StateDb
impl Send for StateDb
impl Sync for StateDb
impl Unpin for StateDb
impl UnsafeUnpin for StateDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more