pub struct Reorder<T> { /* private fields */ }Expand description
Puts the samples of two paths back in the order of their numbers.
docs/extensions.md, section dgram, the resend and the count on two
paths.
The buffer gives each number once, in order. A gap at the expected number waits for a copy, then for a resend, then counts as lost. Time is a value in seconds that the caller gives, so the buffer needs no clock.
Implementations§
Source§impl<T> Reorder<T>
impl<T> Reorder<T>
Sourcepub fn set_small_gaps(&mut self, max: u64, give_up: f64)
pub fn set_small_gaps(&mut self, max: u64, give_up: f64)
Repair each gap of at most max samples on UDP: Reorder::nacks
gives them, Reorder::poll asks for none of them on TCP, and gives
one up at the expected number give_up seconds after it showed.
Sourcepub fn has_gaps(&self) -> bool
pub fn has_gaps(&self) -> bool
True when the buffer holds a sample above the expected number, or knows of a sample above it.
Sourcepub fn nacks(&mut self, now: f64, wait: f64) -> Vec<(u64, u32)>
pub fn nacks(&mut self, now: f64, wait: f64) -> Vec<(u64, u32)>
The small gaps to ask for on UDP now: each gap that stayed for
wait seconds, again each max(10 ms, 1.5 x round trip) until it
closes. At most MAX_GAPS gaps, from the lowest.
Sourcepub fn duplicates(&self) -> u64
pub fn duplicates(&self) -> u64
The count of samples that arrived again, or too late.
Sourcepub fn insert_or_emit(&mut self, number: u64, item: T, out: &mut Vec<T>) -> bool
pub fn insert_or_emit(&mut self, number: u64, item: T, out: &mut Vec<T>) -> bool
Take one sample from either path. When the sample is next in order and
no sample waits in the buffer, it goes directly to out.
Sourcepub fn insert(&mut self, number: u64, item: T) -> bool
pub fn insert(&mut self, number: u64, item: T) -> bool
Take one sample from either path. The result is false for a sample that the buffer already has, or that it gave up.
Sourcepub fn udp_heard(&mut self, now: f64)
pub fn udp_heard(&mut self, now: f64)
A datagram arrived on UDP at now. A small gap is given up only while
datagrams still arrive, so a cut does not drop a sample before
resume/1 can ask for it.
Sourcepub fn lost_below(&mut self, number: u64)
pub fn lost_below(&mut self, number: u64)
The outlet has no sample below number for this inlet: a resend
started at number. The numbers from the expected number up to it
count as lost. docs/extensions.md, resend rule 5.
Sourcepub fn progress(&mut self, now: f64)
pub fn progress(&mut self, now: f64)
Data arrived on TCP at now. A resend can be slow on a slow link, so
the time limit of an open request counts again from this point.
docs/extensions.md, section dgram, resend rule 6.
Sourcepub fn assume_requested(&mut self, from: u64, until: u64, now: f64)
pub fn assume_requested(&mut self, from: u64, until: u64, now: f64)
The numbers from..until are on the way on TCP, as at the start of a
connection with a resume resend. The buffer asks for none of them.
Sourcepub fn drain(&mut self, out: &mut Vec<T>) -> usize
pub fn drain(&mut self, out: &mut Vec<T>) -> usize
Move each sample that follows the expected number to out, in
order. The result is their count.
Sourcepub fn poll(&mut self, now: f64, wait: f64, give_up: f64) -> Option<Action>
pub fn poll(&mut self, now: f64, wait: f64, give_up: f64) -> Option<Action>
Check the gap at the expected number. Call it after each
Reorder::drain.
A gap that stays for wait seconds gives a request. A request with no
answer for give_up seconds gives up the gap: its numbers count as
lost, and the samples after it can go.