pub struct InstallSnapshotChunk {
pub term: u64,
pub leader_id: u64,
pub last_included_index: u64,
pub last_included_term: u64,
pub data: Vec<u8>,
pub shard_id: u64,
pub payload_format: u32,
pub eof: bool,
}Expand description
One chunk of a streamed InstallSnapshot transfer. Raft metadata rides on every chunk (cheap, and makes each chunk self-describing); the receiver takes the header fields from the FIRST chunk. Streaming exists because a transfer snapshot is shard-sized (1.39GB observed): as ONE unary message it needs a giant gRPC message cap and a 2x encode/decode memory spike on both ends, and tonic’s bare 4MiB server default silently blocked follower healing for days.
payload_format 0 (legacy): data is a raw byte slice of ONE monolithic
msgpack payload; the receiver concatenates slices in stream order and
decodes the whole thing at once (peak memory = full payload).
payload_format 1 (framed): each data is ONE self-contained msgpack
SnapFrame (Header / CfBegin / Entries / CfEnd / End); the receiver spools
frames to disk as they arrive and the restore applies them one at a time,
so neither side ever materializes the full payload in memory. A framed
stream is terminated by an explicit eof=true marker chunk — a stream
that ends without one was aborted by the sender (e.g. export failure) and
must be discarded, because gRPC also ends the stream cleanly in that case.
Fields§
§term: u64§leader_id: u64§last_included_index: u64§last_included_term: u64§data: Vec<u8>payload slice (format 0) or one frame (format 1)
shard_id: u64§payload_format: u320 = legacy monolithic slices, 1 = framed
eof: boolframed streams: terminal marker chunk (empty data)
Trait Implementations§
Source§impl Clone for InstallSnapshotChunk
impl Clone for InstallSnapshotChunk
Source§fn clone(&self) -> InstallSnapshotChunk
fn clone(&self) -> InstallSnapshotChunk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InstallSnapshotChunk
impl Debug for InstallSnapshotChunk
Source§impl Default for InstallSnapshotChunk
impl Default for InstallSnapshotChunk
Source§impl Message for InstallSnapshotChunk
impl Message for InstallSnapshotChunk
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for InstallSnapshotChunk
impl PartialEq for InstallSnapshotChunk
impl StructuralPartialEq for InstallSnapshotChunk
Auto Trait Implementations§
impl Freeze for InstallSnapshotChunk
impl RefUnwindSafe for InstallSnapshotChunk
impl Send for InstallSnapshotChunk
impl Sync for InstallSnapshotChunk
impl Unpin for InstallSnapshotChunk
impl UnsafeUnpin for InstallSnapshotChunk
impl UnwindSafe for InstallSnapshotChunk
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request