8000 GitHub - hjpotter92/sonyflake-ex: A distributed unique ID generator inspired by Twitter's Snowflake, rewritten in elixir.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

hjpotter92/sonyflake-ex

Repository files navigation

sonyflake-ex

codecov Build Status

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

Installation

Add the package sonyflake to the list of dependencies in mix.exs:

{:sonyflake_ex, "~> 0.1.0", hex: :sonyflake}

Quickstart

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.

License

The MIT License (MIT).

About

A distributed unique ID generator inspired by Twitter's Snowflake, rewritten in elixir.

Topics

Resources

Stars

Watchers

Forks

Languages

0