pub struct RlcDecoder { /* private fields */ }Expand description
Sliding-window RLC decoder: stores received source and repair symbols and recovers lost source symbols by Gaussian elimination over GF(2^8).
Implementations§
Source§impl RlcDecoder
impl RlcDecoder
Sourcepub fn with_horizon(self, horizon: u32) -> Self
pub fn with_horizon(self, horizon: u32) -> Self
Set the RLC recovery horizon (source ids back from the newest that the solver considers). Should comfortably exceed the encoder’s window so a repair’s whole window is in scope; gaps older than this fall to ARQ.
Sourcepub fn on_source(&mut self, source_id: u32, payload: &[u8]) -> Vec<u32>
pub fn on_source(&mut self, source_id: u32, payload: &[u8]) -> Vec<u32>
Record a received source symbol. A source arrival fills its own slot
directly; recovery of OTHER symbols is driven by repair arrivals
(on_repair), so this does NOT run the (potentially
expensive) Gaussian solve - that would otherwise fire on every single
packet under loss, re-solving the whole in-horizon system each time, when
a new source adds no equation. A late source that completes a pending
system is recovered on the next repair (one arrives every step
symbols), and anything that slips through is caught by the ARQ floor.
Sourcepub fn on_repair(&mut self, r: RepairSymbol) -> Vec<u32>
pub fn on_repair(&mut self, r: RepairSymbol) -> Vec<u32>
Record a received repair symbol. Returns any source ids newly recovered.
Sourcepub fn add_repair(&mut self, r: RepairSymbol)
pub fn add_repair(&mut self, r: RepairSymbol)
Store a repair WITHOUT solving, for a caller that drains a batch of
datagrams first (stamping their arrival before any decode) and then runs
one recover over the whole batch - keeping the
expensive Gaussian solve out of the receive/timing path.
Sourcepub fn recover(&mut self) -> Vec<u32>
pub fn recover(&mut self) -> Vec<u32>
Run one recovery pass over the currently-stored source and repair symbols,
returning any source ids newly recovered. Pairs with add_repair.
Sourcepub fn get(&self, source_id: u32) -> Option<&[u8]>
pub fn get(&self, source_id: u32) -> Option<&[u8]>
The bytes of source symbol source_id, if received or recovered.
Sourcepub fn has(&self, source_id: u32) -> bool
pub fn has(&self, source_id: u32) -> bool
Whether source symbol source_id is present (received or recovered).
Sourcepub fn forget_below(&mut self, floor: u32)
pub fn forget_below(&mut self, floor: u32)
Drop delivered source symbols and spent repairs below floor, to bound
memory on a long-lived flow. A source symbol a remaining repair still
references is kept regardless (the decoder must subtract its known
contribution when solving), so the source floor is capped at the oldest
remaining repair’s window start - forgetting it otherwise would make a
received symbol look unknown and corrupt the linear system.
Sourcepub fn rebase_to(&mut self, base: u32)
pub fn rebase_to(&mut self, base: u32)
Re-base the decoder to deliver from base: drop all stored source and
repair symbols (they belong to the pre-rebase id range another code now
owns) and anchor the recovery horizon at base. The receiver moves its
delivery frontier to base in lockstep, so nothing below base is ever
looked up again.