pub struct ReplicationSnapshot {
pub format_version: u16,
pub last_index: u64,
pub records: Vec<ReplicationSnapshotRecord>,
pub checksum: String,
}Expand description
Integrity-protected portable image of a replication log.
Fields§
§format_version: u16Snapshot encoding version.
last_index: u64One-based index of the final record.
records: Vec<ReplicationSnapshotRecord>Replication records in log order.
checksum: StringSHA-256 checksum over version, index, sequences, and payloads.
Implementations§
Source§impl ReplicationSnapshot
impl ReplicationSnapshot
Sourcepub fn try_from_records(
records: impl IntoIterator<Item = (u64, Vec<u8>)>,
) -> SyncResult<Self>
pub fn try_from_records( records: impl IntoIterator<Item = (u64, Vec<u8>)>, ) -> SyncResult<Self>
Creates a validated snapshot while taking ownership of every payload.
Payload allocations are moved into the snapshot instead of cloned. The same record-count, record-size, sequence-uniqueness and checksum contracts used by durable replication logs are applied.
Sourcepub fn validate(&self) -> SyncResult<()>
pub fn validate(&self) -> SyncResult<()>
Validates this snapshot without cloning record payloads.
Trait Implementations§
Source§impl Clone for ReplicationSnapshot
impl Clone for ReplicationSnapshot
Source§fn clone(&self) -> ReplicationSnapshot
fn clone(&self) -> ReplicationSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReplicationSnapshot
impl Debug for ReplicationSnapshot
Source§impl<'de> Deserialize<'de> for ReplicationSnapshot
impl<'de> Deserialize<'de> for ReplicationSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ReplicationSnapshot
Source§impl PartialEq for ReplicationSnapshot
impl PartialEq for ReplicationSnapshot
Source§impl Serialize for ReplicationSnapshot
impl Serialize for ReplicationSnapshot
impl StructuralPartialEq for ReplicationSnapshot
Auto Trait Implementations§
impl Freeze for ReplicationSnapshot
impl RefUnwindSafe for ReplicationSnapshot
impl Send for ReplicationSnapshot
impl Sync for ReplicationSnapshot
impl Unpin for ReplicationSnapshot
impl UnsafeUnpin for ReplicationSnapshot
impl UnwindSafe for ReplicationSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more