Skip to main content

next_replica

Function next_replica 

Source
fn next_replica(
    replicas: &[ReplicaTarget],
    cursor: Option<ReplicaId>,
) -> Option<ReplicaTarget>
Expand description

Picks the replica after cursor, wrapping around at the end.

replicas must be sorted ascending by replica id. Unsorted input still returns a replica but degenerates the rotation, revisiting some replicas and starving others.