Sonyflake is a distributed unique ID generator inspired by Twitter's Snowflake.
This is an elixir rewrite of the original sony/sonyflake project, written in Go.
A Sonyflake ID is composed of
39 bits for time in units of 10 msec
8 bits for a sequence number
16 bits for a machine id
Add the package sonyflake
to the list of dependencies in mix.exs
:
{:sonyflake_ex, "~> 0.1.0", hex: :sonyflake}
sf = Sonyflake.new()
{:ok, sf, id} = Sonyflake.next_id(sf)
IO.puts(id)
There is a Sonyflake.Setting
submodule to configure the
generator. API docs can be found autogenerated on hexdocs.
The MIT License (MIT).