pub trait SnapshotDbManagerTrait {
type SnapshotDb: SnapshotDbTrait<ValueType = Box<[u8]>>;
type SnapshotDbWrite: SnapshotDbWriteableTrait<ValueType = Box<[u8]>>;
Show 16 methods
// Required methods
fn get_snapshot_dir(&self) -> &Path;
fn get_snapshot_db_name(&self, snapshot_epoch_id: &EpochId) -> String;
fn get_snapshot_db_path(&self, snapshot_epoch_id: &EpochId) -> PathBuf;
fn get_mpt_snapshot_dir(&self) -> &Path;
fn get_latest_mpt_snapshot_db_name(&self) -> String;
fn recovery_latest_mpt_snapshot_from_checkpoint(
&self,
snapshot_epoch_id: &EpochId,
before_era_pivot_hash: Option<EpochId>,
) -> Result<()>;
fn create_mpt_snapshot_from_latest(
&self,
new_snapshot_epoch_id: &EpochId,
) -> Result<()>;
fn get_epoch_id_from_snapshot_db_name(
&self,
snapshot_db_name: &str,
) -> Result<EpochId>;
fn try_get_new_snapshot_epoch_from_temp_path(
&self,
dir_name: &str,
) -> Option<EpochId>;
fn try_get_new_snapshot_epoch_from_mpt_temp_path(
&self,
dir_name: &str,
) -> Option<EpochId>;
fn new_snapshot_by_merging<'m>(
&self,
old_snapshot_epoch_id: &EpochId,
snapshot_epoch_id: EpochId,
delta_mpt: DeltaMptIterator,
in_progress_snapshot_info: SnapshotInfo,
snapshot_info_map: &'m RwLock<PersistedSnapshotInfoMap>,
new_epoch_height: u64,
recover_mpt_with_kv_snapshot_exist: bool,
) -> Result<(RwLockWriteGuard<'m, PersistedSnapshotInfoMap>, SnapshotInfo)>;
fn get_snapshot_by_epoch_id(
&self,
epoch_id: &EpochId,
try_open: bool,
open_mpt_snapshot: bool,
) -> Result<Option<Self::SnapshotDb>>;
fn destroy_snapshot(&self, snapshot_epoch_id: &EpochId) -> Result<()>;
fn new_temp_snapshot_for_full_sync(
&self,
snapshot_epoch_id: &EpochId,
merkle_root: &MerkleHash,
new_epoch_height: u64,
) -> Result<Self::SnapshotDbWrite>;
fn finalize_full_sync_snapshot<'m>(
&self,
snapshot_epoch_id: &EpochId,
merkle_root: &MerkleHash,
snapshot_info_map_rwlock: &'m RwLock<PersistedSnapshotInfoMap>,
) -> Result<RwLockWriteGuard<'m, PersistedSnapshotInfoMap>>;
// Provided method
fn scan_persist_state(
&self,
snapshot_info_map: &HashMap<EpochId, SnapshotInfo>,
) -> Result<SnapshotPersistState> { ... }
}Expand description
The trait for database manager of Snapshot.
Required Associated Types§
type SnapshotDb: SnapshotDbTrait<ValueType = Box<[u8]>>
type SnapshotDbWrite: SnapshotDbWriteableTrait<ValueType = Box<[u8]>>
Required Methods§
fn get_snapshot_dir(&self) -> &Path
fn get_snapshot_db_name(&self, snapshot_epoch_id: &EpochId) -> String
fn get_snapshot_db_path(&self, snapshot_epoch_id: &EpochId) -> PathBuf
fn get_mpt_snapshot_dir(&self) -> &Path
fn get_latest_mpt_snapshot_db_name(&self) -> String
fn recovery_latest_mpt_snapshot_from_checkpoint( &self, snapshot_epoch_id: &EpochId, before_era_pivot_hash: Option<EpochId>, ) -> Result<()>
fn create_mpt_snapshot_from_latest( &self, new_snapshot_epoch_id: &EpochId, ) -> Result<()>
fn get_epoch_id_from_snapshot_db_name( &self, snapshot_db_name: &str, ) -> Result<EpochId>
fn try_get_new_snapshot_epoch_from_temp_path( &self, dir_name: &str, ) -> Option<EpochId>
fn try_get_new_snapshot_epoch_from_mpt_temp_path( &self, dir_name: &str, ) -> Option<EpochId>
fn new_snapshot_by_merging<'m>( &self, old_snapshot_epoch_id: &EpochId, snapshot_epoch_id: EpochId, delta_mpt: DeltaMptIterator, in_progress_snapshot_info: SnapshotInfo, snapshot_info_map: &'m RwLock<PersistedSnapshotInfoMap>, new_epoch_height: u64, recover_mpt_with_kv_snapshot_exist: bool, ) -> Result<(RwLockWriteGuard<'m, PersistedSnapshotInfoMap>, SnapshotInfo)>
fn get_snapshot_by_epoch_id( &self, epoch_id: &EpochId, try_open: bool, open_mpt_snapshot: bool, ) -> Result<Option<Self::SnapshotDb>>
fn destroy_snapshot(&self, snapshot_epoch_id: &EpochId) -> Result<()>
fn new_temp_snapshot_for_full_sync( &self, snapshot_epoch_id: &EpochId, merkle_root: &MerkleHash, new_epoch_height: u64, ) -> Result<Self::SnapshotDbWrite>
fn finalize_full_sync_snapshot<'m>( &self, snapshot_epoch_id: &EpochId, merkle_root: &MerkleHash, snapshot_info_map_rwlock: &'m RwLock<PersistedSnapshotInfoMap>, ) -> Result<RwLockWriteGuard<'m, PersistedSnapshotInfoMap>>
Provided Methods§
fn scan_persist_state( &self, snapshot_info_map: &HashMap<EpochId, SnapshotInfo>, ) -> Result<SnapshotPersistState>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".