Consistent hashing replica preference list
Your task
To replicate a key onto repl distinct physical nodes, a Dynamo-style coordinator finds the key's position on a consistent-hashing ring (one point per node, FNV-1a hash as in the reference, modulo ring_size) and walks clockwise, collecting the first repl DISTINCT nodes encountered (the preference list). Given nodes, the key, ring_size, and repl, return the ordered preference list of node ids. If repl exceeds the number of nodes, return all nodes in ring-walk order starting from the key.
Examples
preference_list(nodes: list[str], key: str, ring_size: int, repl: int) -> list[str]Example 1
Input
preference_list(["A", "B", "C", "D"], "user:42", 1024, 3)Output
["B", "C", "D"]