appendedElsewhere

open suspend fun appendedElsewhere(cursors: Map<Int, Long>): Set<Int>

The partitions among cursors' keys in which another writer may have appeared since this log was last asked about them: a node's tails ask it, all their partitions at once, for the entries other nodes appended, which no hand-over brings them. A partition named calls for a read of its head (and of the store past the cursor when the head is past it); one not named means nothing new was seen, not that nothing lies past its cursor. It may name a partition that holds nothing new: the caller then finds its head at its cursor.

By default the answer is exact and keeps nothing: the partitions whose heads are past their cursors (cursors gives each partition's last sequence the caller has). A store may instead answer from less than the heads and from what it remembers of its previous answers, naming a partition once for each change it sees there; it forgets a partition that a call does not ask about, so the next call that asks about it starts afresh. MongoDB's log does so: it names a partition whose counter lists another node's block it had not listed at the previous call, past the cursor (cursors serve it to leave out a block the caller has read through), and retires its own block that the other node's lies past, so that its next append lands past it and the caller's tail, busy with this node's commits or not, reads the other node's entry in sequence order.