Skip to main content

ReplicationPacket

Struct ReplicationPacket 

Source
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: ReplicationWireVersion

Packet framing format.

§changeset_id: ChangesetId

16-byte changeset identifier for multiplexing.

§sbn: u8

Source block number (MUST be 0 in V1).

§esi: u32

Encoding Symbol ID (ISI).

§k_source: u32

Number of source symbols.

§r_repair: u32

Number of planned repair symbols for this stream configuration.

§symbol_size_t: u16

Symbol size T encoded on wire.

§seed: u64

Deterministic seed for the object’s symbol schedule.

§payload_xxh3: u64

Integrity 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

Source

pub fn new_v2(header: ReplicationPacketV2Header, symbol_data: Vec<u8>) -> Self

Create a versioned fixed-header packet and compute payload integrity hash.

Source

pub fn compute_payload_xxh3(symbol_data: &[u8]) -> u64

Compute packet payload hash.

Source

pub fn attach_auth_tag(&mut self, auth_key: &[u8; 32])

Attach an auth tag for authenticated transport mode.

Source

pub fn verify_integrity(&self, auth_key: Option<&[u8; 32]>) -> bool

Verify payload hash and optional auth tag.

Source

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.

Source

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.

Source

pub fn from_bytes(buf: &[u8]) -> Result<Self>

Decode from wire format.

§Errors

Returns error if buffer is too short.

Source

pub fn wire_size(&self) -> usize

Total packet size on the wire.

Source

pub fn is_source_symbol(&self) -> bool

Whether this packet carries a source symbol (systematic).

Trait Implementations§

Source§

impl Clone for ReplicationPacket

Source§

fn clone(&self) -> ReplicationPacket

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReplicationPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ReplicationPacket

Source§

fn eq(&self, other: &ReplicationPacket) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ReplicationPacket

Source§

impl StructuralPartialEq for ReplicationPacket

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more