cabol / jchash

Jump Consistent Hash NIF library for Erlang/Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jchash

CI

Jump Consistent Hash NIF library for Erlang/Elixir.

This NIF implements the Jump Consistent Hash algorithm, created by John Lamping and Eric Veach developed at Google, Inc. This is the original paper: "A Fast, Minimal Memory, Consistent Hash Algorithm".

Installation

Erlang

In your rebar.config:

{deps, [
  {jchash, "0.1.3"}
]}.

Usage example:

> jchash:compute(1, 2).
0

> jchash:compute(erlang:phash2(os:timestamp()), 100).
22

Elixir

In your mix.exs:

def deps do
  [{:jchash, "~> 0.1"}]
end

Usage example:

> :jchash.compute(1, 2)
0

> System.system_time() |> :erlang.phash2() |> :jchash.compute(100)
22

Testing

$ rebar3 eunit

Copyright and License

Copyright (c) 2016 Carlos Andres Bolaños R.A.

jchash source code is licensed under the MIT License.

About

Jump Consistent Hash NIF library for Erlang/Elixir

License:MIT License


Languages

Language:Erlang 51.3%Language:Makefile 34.7%Language:C 14.1%