#snowflake #twitter #generate #id #unique #globally #system

snowflake_id

SnowFlake is an algorithm adopted by Twitter, whose purpose is to generate globally unique and trend-increasing IDs in a distributed system

2 stable releases

1.0.1 Sep 22, 2021
0.1.0 Sep 22, 2021

#6 in #globally

MIT/Apache

265KB
103 lines

SnowFlake is an algorithm adopted by Twitter, whose purpose is to generate globally unique and trend-increasing IDs in a distributed system.

How many globally unique IDs can the SnowFlake algorithm generate in the same millisecond? Number of IDs in the same millisecond = 1024 X 4096 = 4194304

let mut worker = Snowflake::new(1, 1);

let id = worker.next();

No runtime deps