Trait SnapshotDbTrait

Source
pub trait SnapshotDbTrait:
    KeyValueDbTraitOwnedRead
    + KeyValueDbTraitRead
    + KeyValueDbTraitSingleWriter
    + for<'db> OpenSnapshotMptTrait<'db>
    + Sized {
    type SnapshotKvdbIterTraitTag;
    type SnapshotKvdbIterType: WrappedTrait<dyn KeyValueDbIterableTrait<MptKeyValue, [u8], Self::SnapshotKvdbIterTraitTag>>;

    // Required methods
    fn get_null_snapshot() -> Self;
    fn open(
        snapshot_path: &Path,
        readonly: bool,
        already_open_snapshots: &Arc<RwLock<HashMap<PathBuf, Option<Weak<Self>>>>>,
        open_semaphore: &Arc<Semaphore>,
    ) -> StorageResult<Self>;
    fn create(
        snapshot_path: &Path,
        already_open_snapshots: &Arc<RwLock<HashMap<PathBuf, Option<Weak<Self>>>>>,
        open_semaphore: &Arc<Semaphore>,
        mpt_table_in_current_db: bool,
    ) -> StorageResult<Self>;
    fn direct_merge(
        &mut self,
        old_snapshot_db: Option<&Arc<Self>>,
        mpt_snapshot: &mut Option<SnapshotMptDbSqlite>,
        recover_mpt_with_kv_snapshot_exist: bool,
        in_reconstruct_snapshot_state: bool,
    ) -> StorageResult<MerkleHash>;
    fn copy_and_merge(
        &mut self,
        old_snapshot_db: &Arc<Self>,
        mpt_snapshot_db: &mut Option<SnapshotMptDbSqlite>,
        in_reconstruct_snapshot_state: bool,
    ) -> StorageResult<MerkleHash>;
    fn start_transaction(&mut self) -> StorageResult<()>;
    fn commit_transaction(&mut self) -> StorageResult<()>;
    fn is_mpt_table_in_current_db(&self) -> bool;
    fn snapshot_kv_iterator(
        &self,
    ) -> StorageResult<Wrap<'_, Self::SnapshotKvdbIterType, dyn KeyValueDbIterableTrait<MptKeyValue, [u8], Self::SnapshotKvdbIterTraitTag>>>;
}

Required Associated Types§

Required Methods§

Source

fn get_null_snapshot() -> Self

Source

fn open( snapshot_path: &Path, readonly: bool, already_open_snapshots: &Arc<RwLock<HashMap<PathBuf, Option<Weak<Self>>>>>, open_semaphore: &Arc<Semaphore>, ) -> StorageResult<Self>

Store already_open_snapshots and open_semaphore to update SnapshotDbManager on destructor. SnapshotDb itself does not take care of the update on these data.

Source

fn create( snapshot_path: &Path, already_open_snapshots: &Arc<RwLock<HashMap<PathBuf, Option<Weak<Self>>>>>, open_semaphore: &Arc<Semaphore>, mpt_table_in_current_db: bool, ) -> StorageResult<Self>

Store already_open_snapshots and open_semaphore to update SnapshotDbManager on destructor. SnapshotDb itself does not take care of the update on these data.

Source

fn direct_merge( &mut self, old_snapshot_db: Option<&Arc<Self>>, mpt_snapshot: &mut Option<SnapshotMptDbSqlite>, recover_mpt_with_kv_snapshot_exist: bool, in_reconstruct_snapshot_state: bool, ) -> StorageResult<MerkleHash>

Source

fn copy_and_merge( &mut self, old_snapshot_db: &Arc<Self>, mpt_snapshot_db: &mut Option<SnapshotMptDbSqlite>, in_reconstruct_snapshot_state: bool, ) -> StorageResult<MerkleHash>

Source

fn start_transaction(&mut self) -> StorageResult<()>

Source

fn commit_transaction(&mut self) -> StorageResult<()>

Source

fn is_mpt_table_in_current_db(&self) -> bool

Source

fn snapshot_kv_iterator( &self, ) -> StorageResult<Wrap<'_, Self::SnapshotKvdbIterType, dyn KeyValueDbIterableTrait<MptKeyValue, [u8], Self::SnapshotKvdbIterTraitTag>>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§