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§
Sourcefn get_checkpoint(&self, peer_id: &str) -> SyncResult<Option<(u64, String)>>
fn get_checkpoint(&self, peer_id: &str) -> SyncResult<Option<(u64, String)>>
Returns the last accepted sequence and batch hash for peer_id.
Sourcefn set_checkpoint(
&self,
peer_id: &str,
sequence: u64,
hash: &str,
) -> SyncResult<()>
fn set_checkpoint( &self, peer_id: &str, sequence: u64, hash: &str, ) -> SyncResult<()>
Atomically replaces the sequence and batch hash for peer_id.
Provided Methods§
Sourcefn get_last_sequence(&self, peer_id: &str) -> SyncResult<u64>
fn get_last_sequence(&self, peer_id: &str) -> SyncResult<u64>
Returns the last accepted sequence, or zero when no checkpoint exists.
Sourcefn set_last_sequence(&self, peer_id: &str, sequence: u64) -> SyncResult<()>
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".