Skip to main content

SnapAttemptStore

Trait SnapAttemptStore 

Source
pub trait SnapAttemptStore {
    // Required methods
    fn start_snap_attempt(
        &self,
        generation: SnapGeneration,
    ) -> Result<SnapWrite, SnapSyncError>;
    fn active_snap_write(&self) -> Result<Option<SnapWrite>, SnapSyncError>;
    fn authorize_snap_write(
        &self,
        write: SnapWrite,
    ) -> Result<SnapAttempt, SnapSyncError>;
    fn advance_snap_pivot(
        &self,
        write: SnapWrite,
        generation: SnapGeneration,
    ) -> Result<SnapWrite, SnapSyncError>;
    fn verify_snap_attempt(&self, write: SnapWrite) -> Result<(), SnapSyncError>;
    fn abandon_snap_attempt(&self) -> Result<(), SnapSyncError>;
}
Expand description

Persistence for the attempt that owns downloaded snap state.

Blanket-implemented over node metadata access, so these writes join the caller’s transaction: state, bytecode and the attempt record commit together or not at all.

Required Methods§

Source

fn start_snap_attempt( &self, generation: SnapGeneration, ) -> Result<SnapWrite, SnapSyncError>

Starts an attempt anchored to generation, superseding any already recorded.

Source

fn active_snap_write(&self) -> Result<Option<SnapWrite>, SnapSyncError>

Returns the write an unfinished attempt accepts, if one owns the persisted state.

Source

fn authorize_snap_write( &self, write: SnapWrite, ) -> Result<SnapAttempt, SnapSyncError>

Returns the attempt when write still owns the persisted state, rejecting it otherwise.

Source

fn advance_snap_pivot( &self, write: SnapWrite, generation: SnapGeneration, ) -> Result<SnapWrite, SnapSyncError>

Re-anchors the attempt to generation, refusing writes proved against the previous root.

Source

fn verify_snap_attempt(&self, write: SnapWrite) -> Result<(), SnapSyncError>

Marks the attempt’s downloaded state verified.

Source

fn abandon_snap_attempt(&self) -> Result<(), SnapSyncError>

Gives up on an unfinished attempt, refusing its outstanding writes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> SnapAttemptStore for T
where T: MetadataProvider + MetadataWriter,