Skip to content

Documentation / @etherfold/core / readyForPromotion

Function: readyForPromotion() ​

readyForPromotion<T>(entries, current, view): T | undefined

Defined in: packages/core/src/generation/promotion.ts:213

THE TRIGGER: which held generation, if any, should become canonical NOW.

A candidate is ready the moment its cursor reaches the cursor the CANONICAL generation has -- compared LIVE, never against a snapshot taken when the successor was created, because a snapshot would let a successor be promoted while the incumbent had moved on, which is the state going backwards the default exists to prevent.

ONE at a time, deliberately: a second candidate is still a candidate on the next cycle, and promoting twice inside one advance would publish a generation nobody ever read from.

Arming is what keeps this from being "any non-canonical generation that is level", which would re-promote a successor on the cycle after a REVERT (a reverted-from generation is caught up by construction).

Type Parameters ​

T ​

T

Parameters ​

entries ​

readonly T[]

current ​

T | undefined

view ​

PromotionView<T>

Returns ​

T | undefined