pub struct InstallSnapshotRequest {
pub term: Term,
pub leader_id: NodeId,
pub last_included_index: LogIndex,
pub last_included_term: Term,
pub offset: u64,
pub data: Vec<u8>,
pub done: bool,
}Expand description
InstallSnapshot RPC request (Raft paper Section 7)
Sent by the leader to followers that are too far behind in the log. The snapshot is sent in chunks identified by offset and done flag.
Fields§
§term: TermLeader’s current term
leader_id: NodeIdLeader’s ID so follower can redirect clients
last_included_index: LogIndexThe last included index in the snapshot
last_included_term: TermThe term of the last included index
offset: u64Byte offset into the snapshot data for chunked transfer
data: Vec<u8>Raw snapshot data chunk
done: boolTrue if this is the final chunk of the snapshot
Implementations§
Source§impl InstallSnapshotRequest
impl InstallSnapshotRequest
Sourcepub fn new_complete(
term: Term,
leader_id: NodeId,
last_included_index: LogIndex,
last_included_term: Term,
data: Vec<u8>,
) -> Self
pub fn new_complete( term: Term, leader_id: NodeId, last_included_index: LogIndex, last_included_term: Term, data: Vec<u8>, ) -> Self
Create a new InstallSnapshot request for a complete snapshot (single chunk)
Sourcepub fn new_chunk(
term: Term,
leader_id: NodeId,
last_included_index: LogIndex,
last_included_term: Term,
offset: u64,
data: Vec<u8>,
done: bool,
) -> Self
pub fn new_chunk( term: Term, leader_id: NodeId, last_included_index: LogIndex, last_included_term: Term, offset: u64, data: Vec<u8>, done: bool, ) -> Self
Create a new InstallSnapshot request for a chunk of a snapshot
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if this is a complete (non-chunked) snapshot transfer
Trait Implementations§
Source§impl Clone for InstallSnapshotRequest
impl Clone for InstallSnapshotRequest
Source§fn clone(&self) -> InstallSnapshotRequest
fn clone(&self) -> InstallSnapshotRequest
Returns a duplicate of the value. Read more
1.0.0 · 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 InstallSnapshotRequest
impl Debug for InstallSnapshotRequest
Source§impl PartialEq for InstallSnapshotRequest
impl PartialEq for InstallSnapshotRequest
impl Eq for InstallSnapshotRequest
impl StructuralPartialEq for InstallSnapshotRequest
Auto Trait Implementations§
impl Freeze for InstallSnapshotRequest
impl RefUnwindSafe for InstallSnapshotRequest
impl Send for InstallSnapshotRequest
impl Sync for InstallSnapshotRequest
impl Unpin for InstallSnapshotRequest
impl UnsafeUnpin for InstallSnapshotRequest
impl UnwindSafe for InstallSnapshotRequest
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