seqHighWater
The highest seq this state knows replica has minted, and so the seq insertAfter and insertAllAfter mint past. 0 when it knows of none.
It counts every op this state holds and its compaction floor, so it can be larger than any seq a held op carries, and after advanceClock it is larger than every one. Read it beside lamport to record where minting stands; see advanceClock for what raising it back costs.
Samples
val a = ReplicaId("A")
val (full, minted) = Rga.empty<String>().insertAllAfter(a, RgaId.HEAD, listOf("one", "two", "three"))
// Kept somewhere that is read with the rest, such as an index naming where the ops live.
val lamport = full.lamport
val seq = full.seqHighWater(a)
// Rebuilt from a part that holds only the first op: minting from it would reuse "two"'s id.
val partial = Rga.empty<String>().apply(minted.first())
check(partial.seqHighWater(a) == 1L)
val raised = partial.advanceClock(a, lamport, seq)
check(raised == partial) // no op added: the same state, with its counters raised
val (_, next) = raised.insertAllAfter(a, minted.first().id, listOf("four"))
check(next.single().id.seq == seq + 1)
check(next.single().id.lamport > lamport)Content copied to clipboard