FairShareExecution

The coordination-free spend/reserve surface a consumer gates work on — the honest "either node type" contract shared by both heddle front doors.

Both heddleStatic's HeddleNode (no consensus) and heddleGoverned's GovernedHeddleNode (an H5 governed node) implement this, so an adapter that only needs to reserve-and-charge entitlement — e.g. warp's HeddleAdmissionControl — accepts either without knowing which front door minted the supply. The reservation lifecycle here is exactly the H4 data plane (design §4.4): it is local, coordination-free, and never touches any consensus log.

A reservation earmarks entitlement, the work runs, then complete charges the ledger exactly once (or cancel releases it charging nothing). The verbs are idempotent by local single-writer discipline: a second complete/cancel for the same ReservationId is a no-op.

Inheritors

Functions

Link copied to clipboard
abstract fun cancel(id: ReservationId)

Cancel reservation id — a completion charging zero service (design §4.4). It is for work that never ran. Work that held its earmark settles with complete at what it cost, however it ended, since a cancel of work that ran is charged nothing and its siblings pay for the ride.

Link copied to clipboard
abstract fun complete(id: ReservationId, actualCost: Long)

Complete reservation id, charging actualCost (0 ≤ actualCost ≤ the reserved maximum) and releasing the earmark (design §4.4). Idempotent: a later call for the same id is a no-op, and an unknown id is silently ignored.

Link copied to clipboard
abstract fun earmarked(leaf: GroupId): Long

This peer's total outstanding earmark at leaf leaf — reserved-but-not-yet-completed service (design §4.4). The spendable-now amount is holdings(leaf, self) − earmarked(leaf).

Link copied to clipboard
abstract fun reserve(leaf: GroupId, maximumCost: Long): ReserveOutcome

Earmark up to maximumCost service units against this peer's holdings at leaf leaf (design §4.4). The earmark is local state, not replicated. Returns ReserveOutcome.Reserved carrying the ReservationId to complete against; ReserveOutcome.NoHoldings when available holdings at leaf cannot cover it; or GateClosed when this peer may not author entitlement at all — only a governed node, before its own enroll(self) applies or after it departs (issue #1892).