Rendezvous hashing for crystal that utilises the murmur3 hashing algorithm.
-
Add the dependency to your
shard.yml
:dependencies: rendezvous-hash: github: caspiano/rendezvous-hash
-
Run
shards install
require "rendezvous-hash"
hash = RendezvousHash.new(nodes: ["node1", "node2", "node3"])
hash.find("device1") # => "node3"
hash.remove("node3") # => "node3"
hash.nodes # => ["node1", "node2"]
hash.find("device1") # => "node1"
hash.remove?("node3") # => nil
hash.add("node3") # => ["node1", "node2", "node3"]
hash.find("device1") # => "node3"
hash["device1"] # => "node3"
- Benchmarking
- murmur3 seeding
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Caspian Baska - creator and maintainer