Crates.io | snowflake_uid |
lib.rs | snowflake_uid |
version | 0.1.1 |
source | src |
created_at | 2024-05-05 10:44:18.429359 |
updated_at | 2024-05-06 04:54:44.532228 |
description | A module for generating guaranteed unique IDs among a cluster of nodes using Snowflake logic. |
homepage | https://github.com/SaurabhGoyal/snowflake-rs |
repository | https://github.com/SaurabhGoyal/snowflake-rs |
max_upload_size | |
id | 1230155 |
size | 10,167 |
Snowflake is a crate that provides a simple implementation of unique-id generation based on Twitter's snowflake logic.
+--------------------------------------------------------------------------+
| 1 Bit Unused | 41 Bit Timestamp | 10 Bit NodeID | 12 Bit Sequence ID |
+--------------------------------------------------------------------------+
Generator
and Config
.Config
has a default implementation which provides 2 ^ 21 (2097152) unique ids per millisecond (1024 per node, across 2048 nodes) till year 2149 (~139 years from epoch). These values can be customised to support higher throughput or longer period of valid generation of unique IDs. Default config uses following details -