Struct cfx_storage::ReplicatedState
source · pub struct ReplicatedState<Main> { /* private fields */ }
Implementations§
source§impl<Main: StateTrait> ReplicatedState<Main>
impl<Main: StateTrait> ReplicatedState<Main>
pub fn new<Replicate: StateTrait + Send + 'static>( main_state: Main, replicated_state: Replicate, filter: Option<Box<dyn StateFilter>> ) -> ReplicatedState<Main>
Trait Implementations§
source§impl<Main: StateTrait> StateTrait for ReplicatedState<Main>
impl<Main: StateTrait> StateTrait for ReplicatedState<Main>
fn get(&self, access_key: StorageKeyWithSpace<'_>) -> Result<Option<Box<[u8]>>>
fn set( &mut self, access_key: StorageKeyWithSpace<'_>, value: Box<[u8]> ) -> Result<()>
fn delete(&mut self, access_key: StorageKeyWithSpace<'_>) -> Result<()>
fn delete_test_only( &mut self, _access_key: StorageKeyWithSpace<'_> ) -> Result<Option<Box<[u8]>>>
fn delete_all( &mut self, access_key_prefix: StorageKeyWithSpace<'_> ) -> Result<Option<Vec<MptKeyValue>>>
fn read_all( &mut self, access_key_prefix: StorageKeyWithSpace<'_> ) -> Result<Option<Vec<MptKeyValue>>>
source§fn compute_state_root(&mut self) -> Result<StateRootWithAuxInfo>
fn compute_state_root(&mut self) -> Result<StateRootWithAuxInfo>
It’s costly to compute state root however it’s only necessary to compute
state root once before committing.
fn get_state_root(&self) -> Result<StateRootWithAuxInfo>
fn commit(&mut self, epoch_id: EpochId) -> Result<StateRootWithAuxInfo>
source§impl<Main: StorageStateTraitExt> StateTraitExt for ReplicatedState<Main>
impl<Main: StorageStateTraitExt> StateTraitExt for ReplicatedState<Main>
fn get_with_proof( &self, access_key: StorageKeyWithSpace<'_> ) -> Result<(Option<Box<[u8]>>, StateProof)>
source§fn get_node_merkle_all_versions<WithProof: StaticBool>(
&self,
access_key: StorageKeyWithSpace<'_>
) -> Result<(NodeMerkleTriplet, NodeMerkleProof)>
fn get_node_merkle_all_versions<WithProof: StaticBool>( &self, access_key: StorageKeyWithSpace<'_> ) -> Result<(NodeMerkleTriplet, NodeMerkleProof)>
Compute the merkle of the node under
access_key
in all tries.
Node merkle is computed on the value and children hashes, ignoring the
compressed path.Auto Trait Implementations§
impl<Main> !RefUnwindSafe for ReplicatedState<Main>
impl<Main> Send for ReplicatedState<Main>where
Main: Send,
impl<Main> Sync for ReplicatedState<Main>where
Main: Sync,
impl<Main> Unpin for ReplicatedState<Main>where
Main: Unpin,
impl<Main> !UnwindSafe for ReplicatedState<Main>
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