Struct cfx_storage::state_manager::StateManager
source · pub struct StateManager {
pub number_committed_nodes: AtomicUsize,
/* private fields */
}
Fields§
§number_committed_nodes: AtomicUsize
Implementations§
source§impl StateManager
impl StateManager
pub fn new(conf: StorageConfiguration) -> Result<Self>
pub fn log_usage(&self)
pub fn get_storage_manager(&self) -> &StorageManager
pub fn get_storage_manager_arc(&self) -> &Arc<StorageManager>
sourcepub fn get_state_trees_internal(
snapshot_db: <SnapshotDbManagerSqlite as SnapshotDbManagerTrait>::SnapshotDb,
snapshot_epoch_id: &EpochId,
snapshot_merkle_root: MerkleHash,
maybe_intermediate_trie: Option<Arc<DeltaMpt>>,
maybe_intermediate_trie_key_padding: Option<&DeltaMptKeyPadding>,
intermediate_epoch_id: &EpochId,
intermediate_trie_root_merkle: MerkleHash,
delta_mpt: Arc<DeltaMpt>,
maybe_delta_mpt_key_padding: Option<&DeltaMptKeyPadding>,
epoch_id: &EpochId,
delta_root: Option<NodeRefDeltaMpt>,
maybe_height: Option<u64>,
maybe_delta_trie_height: Option<u32>
) -> Result<Option<StateTrees>>
pub fn get_state_trees_internal( snapshot_db: <SnapshotDbManagerSqlite as SnapshotDbManagerTrait>::SnapshotDb, snapshot_epoch_id: &EpochId, snapshot_merkle_root: MerkleHash, maybe_intermediate_trie: Option<Arc<DeltaMpt>>, maybe_intermediate_trie_key_padding: Option<&DeltaMptKeyPadding>, intermediate_epoch_id: &EpochId, intermediate_trie_root_merkle: MerkleHash, delta_mpt: Arc<DeltaMpt>, maybe_delta_mpt_key_padding: Option<&DeltaMptKeyPadding>, epoch_id: &EpochId, delta_root: Option<NodeRefDeltaMpt>, maybe_height: Option<u64>, maybe_delta_trie_height: Option<u32> ) -> Result<Option<StateTrees>>
delta_mpt_key_padding is required. When None is passed, it’s calculated for the state_trees.
pub fn get_state_trees( &self, state_index: &StateIndex, try_open: bool, open_mpt_snapshot: bool ) -> Result<Option<StateTrees>>
pub fn get_state_trees_for_next_epoch( &self, parent_state_index: &StateIndex, try_open: bool, open_mpt_snapshot: bool ) -> Result<Option<StateTrees>>
sourcepub fn check_make_snapshot(
&self,
maybe_intermediate_trie: Option<Arc<DeltaMpt>>,
intermediate_trie_root: Option<NodeRefDeltaMpt>,
intermediate_epoch_id: &EpochId,
new_height: u64,
recover_mpt_during_construct_pivot_state: bool
) -> Result<()>
pub fn check_make_snapshot( &self, maybe_intermediate_trie: Option<Arc<DeltaMpt>>, intermediate_trie_root: Option<NodeRefDeltaMpt>, intermediate_epoch_id: &EpochId, new_height: u64, recover_mpt_during_construct_pivot_state: bool ) -> Result<()>
Check if we can make a new snapshot, and if so, make it in background.
pub fn get_state_no_commit_inner( self: &Arc<Self>, state_index: StateIndex, try_open: bool, open_mpt_snapshot: bool ) -> Result<Option<State>>
pub fn get_state_for_next_epoch_inner( self: &Arc<Self>, parent_epoch_id: StateIndex, open_mpt_snapshot: bool, recover_mpt_during_construct_pivot_state: bool ) -> Result<Option<State>>
pub fn notify_genesis_hash(&self, genesis_hash: EpochId)
pub fn config(&self) -> &StorageConfiguration
Trait Implementations§
source§impl Drop for StateManager
impl Drop for StateManager
source§impl MallocSizeOf for StateManager
impl MallocSizeOf for StateManager
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl StateManagerTrait for StateManager
impl StateManagerTrait for StateManager
source§fn get_state_no_commit(
self: &Arc<Self>,
state_index: StateIndex,
try_open: bool,
space: Option<Space>
) -> Result<Option<Box<dyn StateTrait>>>
fn get_state_no_commit( self: &Arc<Self>, state_index: StateIndex, try_open: bool, space: Option<Space> ) -> Result<Option<Box<dyn StateTrait>>>
At the boundary of snapshot, getting a state for new epoch will switch
to new Delta MPT, but it’s unnecessary getting a no-commit state. Read more
fn get_state_for_genesis_write(self: &Arc<Self>) -> Box<dyn StateTrait>
fn get_state_for_next_epoch( self: &Arc<Self>, parent_epoch_id: StateIndex, recover_mpt_during_construct_pivot_state: bool ) -> Result<Option<Box<dyn StateTrait>>>
Auto Trait Implementations§
impl !RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl !UnwindSafe for StateManager
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