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>>>

Object Safety§

This trait is not object safe.

Implementors§