Tracks the highest Raft log index applied to each local ETS partition.
The watermark makes state-machine application idempotent: an index that was
already applied (for example during log replay after a restart) is
acknowledged without touching the cached data again. This is what keeps
non-idempotent operations such as increment correct across replay.
Summary
Functions
Claim an index for a partition, returning true when it is newer than the
current watermark and should be applied, or false when it is a replay.
Return the highest applied index for a partition (0 when unknown).
Reset a partition's watermark (used by tests and teardown).
Clear every partition watermark.
Functions
@spec claim(non_neg_integer(), non_neg_integer()) :: boolean()
Claim an index for a partition, returning true when it is newer than the
current watermark and should be applied, or false when it is a replay.
@spec get(non_neg_integer()) :: non_neg_integer()
Return the highest applied index for a partition (0 when unknown).
@spec reset(non_neg_integer()) :: :ok
Reset a partition's watermark (used by tests and teardown).
@spec reset_all() :: :ok
Clear every partition watermark.
Called when the ETS partitions are dropped: the next Raft replay starts from an empty state machine, so every committed entry must be applied again.