pub struct SenderBaselines { /* private fields */ }Expand description
Exact sent bytes with ACK authorization, separate from installed state. See the module recipe for the required send/install/ACK sequence.
Implementations§
Source§impl SenderBaselines
impl SenderBaselines
Sourcepub fn new(limits: BaselineLimits) -> Result<SenderBaselines, BaselineError>
pub fn new(limits: BaselineLimits) -> Result<SenderBaselines, BaselineError>
Fallibly preallocate both budgets. No implicit FPS/game defaults.
Sourcepub fn record_sent(
&mut self,
tick: u32,
bytes: &[u8],
) -> Result<RetainOutcome, BaselineError>
pub fn record_sent( &mut self, tick: u32, bytes: &[u8], ) -> Result<RetainOutcome, BaselineError>
Record full reconstructed bytes only after the caller’s send succeeds. Failed sends must not be recorded. This does not send or authorize bytes. Preflight snapshot size when guaranteed retention before send is needed; an over-budget successful send cannot subsequently be ACKed here.
Sourcepub fn acknowledge(&mut self, tick: u32) -> AckOutcome
pub fn acknowledge(&mut self, tick: u32) -> AckOutcome
Authenticate the session externally first. Exact retained membership is mandatory; a newer unknown tick never authorizes bytes. An older retained generation cannot roll authorization back, even after eviction of the acknowledged generation. ACKs do not refresh eviction order.
Sourcepub fn baseline(&self) -> Option<(u32, &[u8])>
pub fn baseline(&self) -> Option<(u32, &[u8])>
Currently authorized retained bytes. Eviction returns None; the ACK watermark alone is never sufficient to select a delta.
Sourcepub fn select_into(
&self,
tick: u32,
full: &[u8],
delta: &mut Delta,
envelope_bytes: usize,
packet_limit: usize,
) -> Selection
pub fn select_into( &self, tick: u32, full: &[u8], delta: &mut Delta, envelope_bytes: usize, packet_limit: usize, ) -> Selection
Select against exact ACKed retained bytes using checked Delta.
envelope_bytes is the entire outer overhead (24 for current v5 packets),
and packet_limit is the caller’s transport/protocol bound. Delta must
fit that bound and be strictly smaller than full.len(). Overflow,
incompatible lengths, codec limits and insufficient Delta capacity select
full without mutation. No encoding, retention or ACK is implicit. Outer
full-packet validation, tick acceptance and encoding failures remain
caller policy; a full outcome does not authorize sending a stale tick.
Sourcepub fn get(&self, tick: u32) -> Option<&[u8]>
pub fn get(&self, tick: u32) -> Option<&[u8]>
Exact retained sent bytes; lookup does not authorize them.
Sourcepub fn retained_bytes(&self) -> usize
pub fn retained_bytes(&self) -> usize
Sum of retained byte lengths, without a separate acknowledged copy.
Sourcepub fn latest_tick(&self) -> Option<u32>
pub fn latest_tick(&self) -> Option<u32>
Last retained tick; duplicates do not change it.