misha_cafex v0.0.5 Cafex.Consumer.LoadBalancer
Balance partition assignment between Cafex consumers
Summary
Functions
Balance partition assignment between Cafex consumers
Types
Functions
Balance partition assignment between Cafex consumers
Examples
iex> rebalance [], 5
[]
iex> rebalance [{:a, [0, 1, 2, 3, 4]}], 5
[{:a, [0, 1, 2, 3, 4]}]
iex> rebalance [{:a, [0, 1, 2, 3, 4]}, {:b, []}], 5
[{:a, [0, 1, 2]}, {:b, [3, 4]}]
iex> rebalance [{:a, [0, 1, 2, 3, 4]}, {:b, []}, {:c, []}], 5
[{:a, [0, 1]}, {:b, [2, 3]}, {:c, [4]}]
iex> rebalance [{:a, [0, 1, 2]}, {:b, [3, 4]}, {:c, []}], 5
[{:a, [0, 1]}, {:b, [3, 4]}, {:c, [2]}]
iex> rebalance [{:a, [0, 1]}, {:c, [2]}], 5
[{:a, [0, 1, 3]}, {:c, [2, 4]}]
iex> rebalance [{:a, []}, {:b, [0, 1, 2, 3, 4]}], 5
[{:a, [3, 4]}, {:b, [0, 1, 2]}]
More details see the source of this module or test.