pub struct ReplicationPacket {
pub wire_version: ReplicationWireVersion,
pub changeset_id: ChangesetId,
pub sbn: u8,
pub esi: u32,
pub k_source: u32,
pub r_repair: u32,
pub symbol_size_t: u16,
pub seed: u64,
pub payload_xxh3: u64,
pub auth_tag: Option<[u8; 16]>,
pub symbol_data: Vec<u8>,
}Expand description
Replication packet: big-endian header + little-endian symbol payload.
Fields§
§wire_version: ReplicationWireVersionPacket framing format.
changeset_id: ChangesetId16-byte changeset identifier for multiplexing.
sbn: u8Source block number (MUST be 0 in V1).
esi: u32Encoding Symbol ID (ISI).
k_source: u32Number of source symbols.
r_repair: u32Number of planned repair symbols for this stream configuration.
symbol_size_t: u16Symbol size T encoded on wire.
seed: u64Deterministic seed for the object’s symbol schedule.
payload_xxh3: u64Integrity hash over symbol_data.
auth_tag: Option<[u8; 16]>Optional authenticated tag for security mode.
symbol_data: Vec<u8>Symbol data (T bytes).
Implementations§
Source§impl ReplicationPacket
impl ReplicationPacket
Sourcepub fn new_v2(header: ReplicationPacketV2Header, symbol_data: Vec<u8>) -> Self
pub fn new_v2(header: ReplicationPacketV2Header, symbol_data: Vec<u8>) -> Self
Create a versioned fixed-header packet and compute payload integrity hash.
Sourcepub fn compute_payload_xxh3(symbol_data: &[u8]) -> u64
pub fn compute_payload_xxh3(symbol_data: &[u8]) -> u64
Compute packet payload hash.
Sourcepub fn attach_auth_tag(&mut self, auth_key: &[u8; 32])
pub fn attach_auth_tag(&mut self, auth_key: &[u8; 32])
Attach an auth tag for authenticated transport mode.
Sourcepub fn verify_integrity(&self, auth_key: Option<&[u8; 32]>) -> bool
pub fn verify_integrity(&self, auth_key: Option<&[u8; 32]>) -> bool
Verify payload hash and optional auth tag.
Sourcepub fn validate_symbol_size(symbol_size: usize) -> Result<()>
pub fn validate_symbol_size(symbol_size: usize) -> Result<()>
Validate the symbol size against the hard wire limit.
§Errors
Returns error if symbol size exceeds MAX_REPLICATION_SYMBOL_SIZE.
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn to_bytes(&self) -> Result<Vec<u8>>
Encode to wire format: 24-byte big-endian header + symbol data.
§Errors
Returns error if ESI doesn’t fit in 24 bits or symbol exceeds wire limit.
Sourcepub fn from_bytes(buf: &[u8]) -> Result<Self>
pub fn from_bytes(buf: &[u8]) -> Result<Self>
Sourcepub fn is_source_symbol(&self) -> bool
pub fn is_source_symbol(&self) -> bool
Whether this packet carries a source symbol (systematic).
Trait Implementations§
Source§impl Clone for ReplicationPacket
impl Clone for ReplicationPacket
Source§fn clone(&self) -> ReplicationPacket
fn clone(&self) -> ReplicationPacket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReplicationPacket
impl Debug for ReplicationPacket
Source§impl PartialEq for ReplicationPacket
impl PartialEq for ReplicationPacket
impl Eq for ReplicationPacket
impl StructuralPartialEq for ReplicationPacket
Auto Trait Implementations§
impl Freeze for ReplicationPacket
impl RefUnwindSafe for ReplicationPacket
impl Send for ReplicationPacket
impl Sync for ReplicationPacket
impl Unpin for ReplicationPacket
impl UnsafeUnpin for ReplicationPacket
impl UnwindSafe for ReplicationPacket
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.