WaitExplanation

sealed interface WaitExplanation

Why a leaf is waiting, as LocalHeddle.explain answers it: the first reason, in Kind order, that stops the next LocalHeddle.acquire from picking it.

Each arm agrees with that acquire: WouldBePickedNext exactly when it would pick the leaf, and every other arm only when it would not. BehindAtLevel also names the child it would pick instead, at the first level where that child is not the leaf's.

As a hold reason

kind is the stable, ordered name of the arm, for a log line or a telemetry attribute. To tell when a leaf's reason changes, compare kind and the arm's group ids, not the whole value: BehindAtLevel's two rationals move with every pick under that parent, so a reader that compared them would see a new reason on every slot.

Inheritors

Types

Link copied to clipboard
data class AtCeiling(val group: GroupId, val limit: Long) : WaitExplanation

group, on the leaf's path, has at least limit leases open beneath it, its concurrency ceiling (Topology.Node.maxConcurrent), so no pick goes to the leaf until enough of them close. A limit of 0 is a pause. When several groups on the path are at their ceilings, group is the one nearest the root: the whole subtree waits on it.

Link copied to clipboard
data class BehindAtLevel(val parent: GroupId, val nextChild: GroupId, val leafSideVirtualService: Rational, val front: Rational, val eligibleFront: Rational) : WaitExplanation

Another child goes first at parent, the first group on the leaf's lineage where the next pick leaves it: nextChild is the child it picks there instead.

Link copied to clipboard

The arms of a WaitExplanation, in the order they are checked; their order is part of the API.

Link copied to clipboard
data class LifetimeExhausted(val parent: GroupId) : WaitExplanation

The next acquire stops at parent at the lifetime limit (see "The lifetime limit" on LocalHeddle): an edge below parent has no room for the reservation under the watermark, or, with parent the root, the root cannot fund it without minting past the watermark. The same arm as AcquireOutcome.LifetimeExhausted.

Link copied to clipboard
data class NoLiveLineage(val at: GroupId) : WaitExplanation

No pick can end at the leaf at: it is the root, it has an ACTIVE child, the topology does not declare it leasable (a group with nothing attached, not a lane), or the edges from the root down to it are not all ACTIVE (a reload is removing or reshaping it). While this holds its work counts as idle, so it banks no credit (see LocalHeddle). The same arm as AcquireOutcome.NoLiveLineage, with at the leaf, as from LocalHeddle.admit.

Link copied to clipboard

The leaf is waiting, but this slot cannot run it: it is not in the eligible set.

Link copied to clipboard

The leaf is not in the waiting set: it has no work queued.

Link copied to clipboard

The root holds less than the reservation, so the next acquire is refused whoever is waiting.

Link copied to clipboard

The next acquire, on these sets and this reservation, picks this leaf.

Properties

Link copied to clipboard

The arm, by name. Declared in the order LocalHeddle.explain checks them.