Skip to main content

SyncCheckpointStore

Trait SyncCheckpointStore 

Source
pub trait SyncCheckpointStore: Send + Sync {
    // Required methods
    fn get_checkpoint(&self, peer_id: &str) -> SyncResult<Option<(u64, String)>>;
    fn set_checkpoint(
        &self,
        peer_id: &str,
        sequence: u64,
        hash: &str,
    ) -> SyncResult<()>;

    // Provided methods
    fn get_last_sequence(&self, peer_id: &str) -> SyncResult<u64> { ... }
    fn set_last_sequence(&self, peer_id: &str, sequence: u64) -> SyncResult<()> { ... }
}
Expand description

Sync checkpoint storage contract by peer id.

Required Methods§

Source

fn get_checkpoint(&self, peer_id: &str) -> SyncResult<Option<(u64, String)>>

Returns the last accepted sequence and batch hash for peer_id.

Source

fn set_checkpoint( &self, peer_id: &str, sequence: u64, hash: &str, ) -> SyncResult<()>

Atomically replaces the sequence and batch hash for peer_id.

Provided Methods§

Source

fn get_last_sequence(&self, peer_id: &str) -> SyncResult<u64>

Returns the last accepted sequence, or zero when no checkpoint exists.

Source

fn set_last_sequence(&self, peer_id: &str, sequence: u64) -> SyncResult<()>

Updates only the accepted sequence while preserving the stored hash.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§