pub(crate) struct DeferredEffects {
q: VecDeque<Option<Deferred>>,
}Expand description
The ProxyEvent::ActionApplied events owed at release, in queue order.
A sibling FIFO of PendingQueue rather than a field on Pending,
because Pending is egress.rs’s type and reporting is not its
concern — that module deliberately emits no events at all.
§The three-call discipline
Exactly one entry is pushed by execute on every
PendingQueue::push, so self.len() == pending.len() at every point
the caller can observe. In session.rs:
- release arm — one
Self::popperPendingQueue::pop_next_due, and eachSomegoes toReporter::applied_deferred; - after a
DrainOutcome::Complete—Self::take_all, and everySomein it goes toapplied_deferred: the drain wrote them, in order, and they are owed; - after any other
DrainOutcome—Self::clear, and nothing is emitted. Whatever the fallback could not flush is reported once asImpairmentKind::QueuedBytesAtTeardowninstead. The missing second event is the point: a unit lost at teardown must not have reported aReplacedthat never reached the wire.
Fields§
§q: VecDeque<Option<Deferred>>Implementations§
Source§impl DeferredEffects
impl DeferredEffects
Sourcepub(crate) fn len(&self) -> usize
pub(crate) fn len(&self) -> usize
How many entries are owed. Equal to PendingQueue::len().
Read only by the tests below, which assert exactly that equality —
the three-call discipline is what the pipe loops use, and none of
them needs a count. Kept rather than #[cfg(test)]d because the
equality is the ledger’s whole invariant and a reader looking for it
should find the accessor beside it.
Sourcepub(crate) fn pop(&mut self) -> Option<Deferred>
pub(crate) fn pop(&mut self) -> Option<Deferred>
The entry for the unit that was just released.
Sourcepub(crate) fn take_all(&mut self) -> Vec<Deferred>
pub(crate) fn take_all(&mut self) -> Vec<Deferred>
Every entry still owed, in order. For a drain that completed.
Sourcefn push(&mut self, entry: Option<Deferred>)
fn push(&mut self, entry: Option<Deferred>)
Record one entry against one PendingQueue::push.