consistenthash
consistenthash copied to clipboard
too many ids
(Nice illustration and great use of sort.Search, BTW)
I think the example would be clearer if the code clearly distinguished between node ids and keys. That is (if I've understood correctly), the argument to Get should be named "key" because it's not a node id - it maps from a key to a node id - that being the whole point of the hash.
It might even make sense to define:
type NodeId string
or use []byte for keys.
It would also be good to have proper doc comments, even though the article explains things - a bit of redundancy doesn't harm.