pub struct RefusalQueue<R> { /* private fields */ }Expand description
The response stage’s end of the refusal queue.
Everything here works on the refusals taken in by the last
sync; those made visible since wait for the next one.
A stage iteration goes:
idle_bound, then read the output ring;sync, then drain the control channel;release— with the idle bound if the read came back empty, else before the first slot of each event in the batch.
Implementations§
Source§impl<R: Copy> RefusalQueue<R>
impl<R: Copy> RefusalQueue<R>
Sourcepub fn idle_bound(&mut self) -> Option<u64>
pub fn idle_bound(&mut self) -> Option<u64>
The release bound for an iteration whose output read comes back
empty: the matching stage’s progress on the input ring. None when
no synced refusal waits, so the steady state leaves the matching
stage’s counter alone.
Must be taken before the read. Every event below the progress had all its output slots published before the progress moved, so a read that finds the ring empty afterwards has seen all of them.
Sourcepub fn sync(&mut self) -> bool
pub fn sync(&mut self) -> bool
Take in the refusals the reader has made visible so far, and report whether any waits. One load of the queue’s cursor.
Call after reading the output ring, so that every refusal due before an event in that batch is taken in, and before draining the control channel, so that every refusal taken in belongs to a connection the drain registers.
Sourcepub fn release(&mut self, bound: u64, emit: impl FnMut(Refusal<R>))
pub fn release(&mut self, bound: u64, emit: impl FnMut(Refusal<R>))
Hand emit every synced refusal whose request came before bound,
oldest first.
Call with the input sequence of an output slot before handling the
first slot of that event — everything published before it has been
answered — or with idle_bound when the output
ring is empty. Never between two slots of one event: the refusal
would split that event’s reply.