SlotFinals

@Serializable
data class SlotFinals(val issued: Long, val returned: Long, val leafSpent: Long, val rollupSpent: Long, val transfers: Map<ReplicaId, Long> = emptyMap())

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).

Every (edge, counter, replica) slot is single-writer, so when replica r has marked an edge locally unwritable it can read its own slots and declare them final: nobody else ever writes them, and r has just sworn off. That declaration, recorded in the log, is what turns the relocation magnitude from a gossip-view read into a deterministic function of the log prefix.

Why the transfer row belongs here (issue #2377)

EntitlementLedger.relocationPatch's receiver on the production path is FenceState.relocations in :kuilt-heddle, which accumulates only the relocation patches the control plane itself authored — so it carries no transfers rows, ever. A move derived there could neither see the strand's hand-offs (to refuse) nor carry them (to conserve), and the rows were abandoned on the dead generation's key (#2366).

The row is declarable on exactly the argument that makes the four counters declarable, and one more: transfers[path][donor] is written only by donor, and once the edge is retired it is no longer any group's live inbound, so EntitlementLedger.transfer can never write that key again. The row is frozen at barrier time, at its own writer.

Re-acks are legal (a restarted peer re-applies the barrier and acks again) and join by per-slot max — join — so a late anti-entropy recovery can only ever raise a recorded final, never lower it. Every field is grow-only in time at its writer, so max is the correct join, and transfers joins per recipient by the same rule.

transfers is a wire-schema evolution, and how a build that cannot read it behaves

This is a @Serializable type carried inside a ControlCommand.QuiesceAck, i.e. on the control log. ControlLogCodec decodes with the default Cbor, which is encodeDefaults = false and ignoreUnknownKeys = false. The first half keeps most acks unchanged: an ack whose transfers is the default emptyMap() emits no field. The second half means an ack that actually carries a row cannot be read by a build from before this field.

Such a build dates from before the control log carried a header, so it gets no protection from #1738's fail-closed rule. It drops the ack and reads the prefix as fully applied, which leaves a permanent local divergence in a FenceState every peer is meant to hold equal, and anti-entropy cannot repair that because it is not in the gossip-merged data plane. Two cases reach it: rolling one peer back to a pre-#2377 binary, and booting an old binary on a peer that was offline. Upgrading together is what keeps both away. A build that does have the header stops at an ack it cannot read rather than diverging, which is the rule any later change to this type falls under.

Constructors

Link copied to clipboard
constructor(issued: Long, returned: Long, leafSpent: Long, rollupSpent: Long, transfers: Map<ReplicaId, Long> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

this replica's own hand-offs at the fenced edge's path key, recipient → cumulative. Empty for a replica that never handed entitlement to anyone there — which is most of them, and is why the field defaults.

Functions

Link copied to clipboard

The per-slot max of two acks for the same (edge, replica) — a re-ack never lowers a final.