Twitter's Snowflake UUID generator in Erlang.
Go to file
Sergey Yelin de159486ef
Switch to pg (#10)
Switch to pg
2021-01-12 16:40:10 +03:00
.github/workflows Switch to pg (#10) 2021-01-12 16:40:10 +03:00
src Switch to pg (#10) 2021-01-12 16:40:10 +03:00
test MSPF-545: Add env variable matching for machine id (#9) 2020-08-18 01:12:48 +03:00
.gitignore Add Github actions CI (#3) 2020-03-25 20:10:52 +03:00
Makefile Move warnings_as_errors to dedicated profile (#7) 2020-05-26 12:05:30 +03:00
README.md Fix possibility of non-monotonic id generation after clock adjustment (#5) 2020-03-31 15:19:52 +03:00
rebar.config Move warnings_as_errors to dedicated profile (#7) 2020-05-26 12:05:30 +03:00
rebar.lock Add Github actions CI (#3) 2020-03-25 20:10:52 +03:00

Snowflake: a 64-bit UUID generator

Original design by Twitter.

1> application:start(snowflake).
2> snowflake:new().
<<0,231,97,68,12,192,0,0>>
3> snowflake:serialize(snowflake:new()).
<<"AOdiTg5AAAA=">>
4> sets:size(sets:from_list([snowflake:new() || _I <- lists:seq(1,100000)])).
100000
5> lists:map(fun ({T, _}) -> T end,[timer:tc(snowflake, new, []) || _I <- lists:seq(1,100)]).
[93,46,42,42,42,53,55,43,42,43,73,36,34,33,39,52,48,39,35,
 54,36,34,33,34,40,35,33,33,34|...]