Struct cfx_statedb::StateDbGeneric
source · 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 delete_all<AM: AccessMode>( &mut self, key_prefix: StorageKeyWithSpace<'_>, debug_record: Option<&mut ComputeEpochDebugRecord> ) -> Result<Vec<MptKeyValue>>
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 !RefUnwindSafe for StateDb
impl Send for StateDb
impl Sync for StateDb
impl Unpin for StateDb
impl !UnwindSafe 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