Package-level declarations
Types
What LocalHeddle.acquire did.
What LocalHeddle.admit did: AcquireOutcome.Acquired or AcquireOutcome.NoLiveLineage. It shares those two arms with AcquireOutcome and has no other, since an admission makes no pick and is never refused for supply or for the lifetime limit: work already started is charged.
What one FairShareAllocator.schedule call did at a parent: delegated something, found nothing to delegate, or stopped because the parent cannot be ordered at all or its pick met the lifetime limit.
What a FairShareAllocator remembers between calls, as a value: the wake clamps it has computed, the demanding state each edge was last observed in (design §7.2, issues #1695, #1714), and each parent's net-service clock with the departures read against it (#3376).
What a checked LocalHeddle.apply did: Applied the edit, or refused it whole because the tree it started from is no longer the one running, as TreeChanged.
What LocalHeddle.apply did: the applied steps, in the order they ran, and one refusal per child whose change did not land, sorted by child.
Identity of one attachment generation — the immutable parent→child edge that carries fairness state (see AttachmentRecord). There is exactly one AttachmentId per generation: changing anything fairness-significant (weight, parent, a reset) mints a new id rather than mutating an existing one, so old generations keep their history forever.
The immutable fact of one attachment generation — a parent→child edge in the fairness tree, together with the child's weight among its siblings.
One FairShareAllocator.pickChild result: the grant to delegate, and the ledger it must be delegated on, in which every active child of the parent is seated.
The nine per-edge GCounter families of EntitlementLedger — four base, five relocation. Names one family for EntitlementLedger.storedSlot, whose contract is that every family is grow-only: no piece on any state may lower a stored slot. HeddleInternalApi — test + derivation support.
The parent-facing view of one edge — everything a parent needs to schedule a child, and deliberately nothing more. It exposes how much entitlement was issued down the edge, how much was returned, and how much service was spent through it; the child's queues, identities, placement, and leaf receipts are simply not in this projection. Information hiding here is a hard interface boundary, not a convention (design §4.5).
The replicated, conflict-free tally of who was granted what fairness entitlement, who passed it down, and who spent it.
One peer's fair-share scheduler: it hands this peer's holdings at a parent down to the children that want them, one quantum at a time, in the order HeddlePolicy picks (design §7.3).
The outcome of one HeddlePolicy.pick: delegate amount service units down the edge named by attachment. The caller applies the patch to its ledger before the next pick (design §7.3 step 5).
Identity of one group in the fairness tree — a tenant, a lane, a leaf where work actually runs. Opaque, value-equal, and stably serialized: a GroupId is just a stable string name, compared as a string so every peer orders a set of groups identically.
Marks the protocol the entitlement ledger shares with heddle's own control plane, and nothing else. It carries no stability promise for consumers.
The reference EEVDF allocation policy — a pure function from edge summaries, demand, and immutable attachment policy to a single delegation choice (design §7). It inspects nothing else: no global queues, no descendants, no wall clock, no randomness, no floating point. Purity is what makes it testable at virtual time and safe to run divergently on partitioned peers — a bad local decision only misplaces entitlement, it can never create any.
What LocalHeddle.reconcileLeases found: the two ways the caller's running work and the engine's open leases can disagree. Both lists are in LeaseId order.
Where a FairShareAllocator reads the ledger and lands its writes.
An integrity fault EntitlementLedger.validate derives from merged state.
A fair-share scheduler for one process: it decides which group's work runs in each free slot, so that over time each group gets the share its weight promises, and it keeps the books on what each one actually used.
How far a LocalHeddle has come: the epoch it was started with, and how many calls that can change it have returned since, count. Ordered by epoch, then by count, like a LeaseId.
Everything a LocalHeddle needs to carry on after a restart, as one value you can encode, as JSON or CBOR, and store: the books, the open leases, how many slots the engine was sized for, what the fair-share allocator remembers, and the topology it last applied. Take one with LocalHeddle.persist, and start an engine from it with LocalHeddle.restore.
A LocalHeddle's state, as one immutable value: once taken, safe to read or hand to another thread without the caller's scheduling lock. What a restart needs is LocalHeddleSnapshot, taken by LocalHeddle.persist; this is the status view.
The questions you can ask a LocalHeddle without changing it, asked of a saved state instead of a running engine: who goes next (previewPicks), why a leaf is waiting (explain), what share a leaf is owed (entitlement), and what share every group is owed (shareLine). An admin screen that holds only the last stored snapshot gets the same answers the engine that took it would give, with no engine to start and nothing to move.
How a LocalHeddle sizes a lease, how much idle credit a waking group keeps, and how far ahead it mints supply.
Identity of one mint — a single act of introducing root supply into the ledger. Mints are keyed by MintId rather than by the holder's replica id so that two independently-recorded mints union instead of max-colliding: under control-plane failover the same holder may be credited by more than one committed mint, and each must survive the merge.
Names an entitlement path by its final edge. Each group has exactly one active inbound edge, so the edge names the whole path from the root — no List<AttachmentId> is ever needed as a key. The root path has no final edge and is named by the ROOT sentinel.
Tuning for one allocation round (design §7.3). Every field is a hard cap in service units; the round grants the smallest of all the applicable caps.
One immediate child, as the policy sees it: the immutable attachment metadata (record — parent, child and weight), the parent-facing accounting (summary — issued/returned/spent), the child's advertised demand, the replicated virtual-time seat (gauge paired with baseIssued), and the scheduler-local wake clamp (offsetTicks).
What a checked LocalHeddle.previewApply found: Previewed, or ApplyOutcome.TreeChanged when the checked apply at the same moment would refuse, since the tree the edit started from is no longer running. It shares that arm with ApplyOutcome, so a preview never shows a result the save would refuse.
An exact rational number — a numerator/denominator pair over Long, kept reduced to lowest terms with a strictly positive denominator.
The outcome of deriving the §4 generation-move from log-recorded acked finals (EntitlementLedger.relocationPatch). Three outcomes, all deterministic functions of the same inputs, so every peer derives the identical one.
What LocalHeddle.decode found in a stored snapshot.
A non-negative quantity of service — the abstract unit the ledger accounts in (CPU-milliseconds, tasks, tokens; whatever the consumer meters). Always >= 0; a negative amount of service is meaningless and is rejected at construction rather than allowed to poison the tally.
One replica's final authored values on a fenced edge — its four base counter slots and its own transfer row at the edge's PathKey — the promise a ControlCommand.QuiesceAck carries (docs/heddle-ledger-relocation-design.md §6.2 step 2).
Why one child's change did not land in a LocalHeddle.apply.
How much supply a LocalHeddle keeps ahead of its leases, in rounds of capacity: one round is every slot (LocalHeddle.reconcileCapacity) leased once at LocalPolicy.defaultReservation.
The tree you write in a config file: who shares the pool, and in what proportions.
One difference between two trees, named the way the admin who edited them thinks of it: a lane added, a weight changed, a template removed. Topology.changesTo lists them, so an admin page can show what an edit does before it is applied.
The fair-share tree exactly as an admin wrote it, before anything is checked.
The children of one group while a draft is being written, in the order they are declared.
Marks the draft scopes, so a block written inside a group cannot quietly reach a member of an enclosing group.
The outcome of one edit of a TopologyDocument: the edited document, or why the edit was refused. An edit never throws, and a refused edit changes nothing.
The outcome of Topology.from: a checked tree, or everything wrong with the document.
What applying a candidate topology would do, worked out on a copy: nothing it came from changes. Take one with LocalHeddle.previewApply from a running engine, or with LocalHeddleSnapshot.previewApply from a stored snapshot.
One thing wrong with a topology, addressed so a config page can show it beside the right line.
One step of moving a ledger to a new Topology. Topology.diff lists them in the order they must run, and an interpreter applies them one at a time.
Writes a Weight as the text an admin writes: "3" for a whole number, "3/2" for a ratio.
A virtual time kept unreduced, as a sum of positions over a weight: V = ticks / (G · w), where w = weightNumerator / weightDenominator.
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.
A sibling's fairness share, expressed as a positive integer ratio.
Functions
Whether activating edge on this ledger keeps its parent's active children inside the weight budget: true when LocalHeddle.apply would let the activation through on budget grounds, false when it would refuse it as over budget.
Adds child, a TopologyDocument.Group with anything beneath it or a TopologyDocument.Lane, as the last child of the group at parent; [] adds it to the root. Every existing address is unchanged, and TopologyEdit.Edited.path is the new child's.
The steps that attach the child at path, read from root down, at the weight the template it is attached under gives, and every attached group above it that is not attached yet, in the same list: [Prepare, Activate] for a new child of an attached group, the prepares top-down and then the activations top-down when its ancestors are new too, [Activate] when only the prepare landed, and [] when the whole path is attached. Each name is opaque and lives in its own namespace, so it never collides with a declared child, however it is spelt.
The ledger id of the attached child name of the group at group, read from root down. A child attached beneath an attached one has no form here: read its id with findGroupId and a GroupPath.Nested.
Every TopologyChange that turns this tree into after, in document order: walking the tree from the root down, a node's own changes come before its children's, and within a group the children of after come in the order written, followed by the children it no longer has, in the order they were written before. Empty exactly when the two trees differ in nothing but the order of siblings.
The steps that detach the child at path, and every child attached beneath it: [Close, Retire] for an attached leaf, [Retire] when it is already closing, and [] when there is nothing left to do. Beneath an attached group the whole subtree goes, closes top-down and retires bottom-up, so nothing is retired while a child beneath it still has a live edge. A retire is refused while work beneath it is outstanding or an open lease crosses it, even one reserving nothing, and so is every retire above it; detach again, or diff, once it has drained. Attaching the group again brings none of its children back.
The ledger id of the group at path, or null when this topology has no such group: a GroupPath.Declared it does not declare, a GroupPath.Attached whose group has no template, or a GroupPath.Nested whose parent's template carries no template. Never throws.
Moves the child at path, with everything beneath it, to be the last child of the group at parent; [] is the root. parent is an address in this document, before the move, and TopologyEdit.Edited.path is where the child lands after it.
Removes the child at path, with everything beneath it. Later siblings move up one index, and TopologyEdit.Edited.path is the parent's. A group left with no children and no template is a problem Topology.from reports.
Renames the node at path to name, keeping everything else about it and everything beneath it. [] renames the root. The name is not checked here; Topology.from reports an empty one.
Sets the maxConcurrent ceiling of the child at path: a count, 0 to pause it, or null to clear the ceiling. Not checked here; Topology.from reports a negative one. A group's template ceiling is not this one: it is on TopologyDocument.ChildTemplate.
Sets the template of the group at path to template, replacing the whole of the old one, nested templates included; null removes it. A template is what lets the app attach children to the group while it runs, and says what each one gets (see TopologyDocument.ChildTemplate). To change one field, pass a copy of the group's own. Nothing in template is checked here; Topology.from reports a bad weight or a negative ceiling at the group's path.
Sets the weight of the child at path to weight, written as text the way a file writes it: "3" or "3/2". The text is not checked here; Topology.from reports a bad one.
Whether weight could be activated at all: true when it fits the weight budget as the only active child of its parent, false when no parent could ever take it.