Date: 2026-05-29
Time: 12:54
I'll work from the test file contents, which reveal the implementation's full API surface.
consistent-hashing/consistent_hashing.py — The ring implementation: how vnodes are placed, how the bisect-based lookup works, and how weighted nodes multiply vnode countconsistent-hashing/consistenthashing.py:addnode — How the transfer map is computed during node addition — this is the key operational primitivevnode-balance-tradeoffs — Why 150 vnodes is the default: the tradeoff between memory/lookup cost and load uniformity, and how this interacts with weighted nodesconsistent-hashing/testertestconsistent_hashing.py — The "tester of tests" pattern used across this repo — what meta-properties does it check about the test suite itself?consistent-hashing-replication-preference-list — How get_nodes() walks the ring skipping duplicate physical nodes to build a Dynamo-style preference listconsistent-hash-ring-uses-32-bit-space — The ring's hash space is [0, 2³²), as validated by testringpositionvalidrangeconsistent-hash-get-nodes-first-equals-get-node — getnodes(key)[0] always equals getnode(key) — the preference list's head is the primary replicaconsistent-hash-add-node-is-idempotent — Adding a node that already exists does not change the ring's node count or key assignmentsconsistent-hash-replication-requires-sufficient-physical-nodes — getnodes() raises ValueError rather than silently under-replicating when replicationfactor exceeds the number of physical nodesconsistent-hash-membership-change-returns-transfer-map — Both addnode() and removenode() return a dict[(start, end), (fromnode, tonode)] describing which key ranges moved between which nodes