readIndex

open suspend fun readIndex(): Long

Confirms this leader still holds a voter-quorum at its current term, then returns a read index: a commit index ri such that any state machine that has applied through ri reflects every write committed before this call. The read is linearizable once the caller's apply loop reaches ri. The leader does not write to the log.

Concurrent calls in the same heartbeat window share one round. A single-voter cluster returns immediately. A freshly-elected leader suspends until its current-term no-op commits before returning. Because the state machine is external (driven by committed), the caller must wait until it has applied through the returned index — see awaitRead.

Throws

if this node is not the leader (including learners).

if leadership is lost before the round confirms.