Created
October 3, 2019 14:01
-
-
Save sikanrong/4af0a1741d79d5a934ee8dabead9112c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(14)> ring = HashRing.new() |> HashRing.add_node(:a) |> HashRing.add_node(:b) | |
#<Ring[:a, :b]> | |
iex(15)> [:foo, :bar, :baz, :flop] |> Enum.each(fn(k) -> IO.puts(HashRing.key_to_node(ring, k)) end) | |
b | |
b | |
b | |
a | |
:ok | |
iex(16)> ring = HashRing.add_node(ring, :c) | |
#<Ring[:a, :c, :b]> | |
iex(17)> [:foo, :bar, :baz, :flop] |> Enum.each(fn(k) -> IO.puts(HashRing.key_to_node(ring, k)) end) | |
c | |
c | |
b | |
a | |
:ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment