pub(crate) struct Pending {
due_at: Instant,
expected_at: Instant,
gate: Option<Gate>,
item: Item,
shape: Option<ShapeTag>,
}Expand description
One unit of traffic waiting for its release time.
Fields§
§due_at: InstantThe earliest instant this unit may be written, and the only instant that gates it. Set once, by whoever built the unit, and never rewritten by the queue — see the module doc’s Ordering is the queue’s; readiness is the unit’s.
expected_at: InstantWhen the queue expects to write it, given everything ahead of it:
max(due_at, tail.expected_at, now) at push time.
Reporting and lateness only. It gates nothing, and it is
deliberately an over-estimate for a unit queued behind a Hold,
whose gate may open long before its EgressConfig::max_hold
ceiling.
gate: Option<Gate>A Hold’s gate. Releasing it makes the unit due before due_at,
which for a held unit is the EgressConfig::max_hold ceiling.
item: ItemWhat writing it does.
shape: Option<ShapeTag>The shaper’s tag, on a shaped stream only. Attached by
PendingQueue::push from the class the pipe loop most recently
resolved, so exec’s pushes carry it without exec naming a class.
Implementations§
Source§impl Pending
impl Pending
Sourcepub(crate) fn bytes(raw: Bytes, due_at: Instant) -> Self
pub(crate) fn bytes(raw: Bytes, due_at: Instant) -> Self
Bytes to write no earlier than due_at.
Sourcepub(crate) fn terminal(terminal: Terminal) -> Self
pub(crate) fn terminal(terminal: Terminal) -> Self
A positional terminal, due as soon as the queue ahead of it drains.
Sourcepub(crate) fn with_gate(self, gate: Gate) -> Self
pub(crate) fn with_gate(self, gate: Gate) -> Self
Attach a Hold’s gate. due_at stays the max_hold ceiling.
Sourcepub(crate) fn expected_at(&self) -> Instant
pub(crate) fn expected_at(&self) -> Instant
When the queue expected to write it. Never a gate; see the field.
Sourcepub(crate) fn is_terminal(&self) -> bool
pub(crate) fn is_terminal(&self) -> bool
Whether this unit ends the stream.
Sourcefn is_due(&self, now: Instant) -> bool
fn is_due(&self, now: Instant) -> bool
Whether this unit may be written at now, on its own account.
Readiness only: whether anything is still queued ahead of it is the
deque’s business, and PendingQueue::pop_next_due answers that by
looking at the front and nowhere else.
A released gate makes it due, regardless of due_at. Without
that clause, releasing a Hold early wakes the release branch to
find nothing due and the loop spins hot until
EgressConfig::max_hold — one of the two ways this loop can spin
hot, and the one that is invisible from the call site.
expected_at is deliberately not consulted: it is the queue’s
estimate, and for a unit behind a Hold it is that hold’s ceiling.
Gating on it is what stranded whole streams behind a released gate.