Expand description
atomic-snowflake
Zero-dependency lock-free monotonic 64-bit Snowflake ID, 128-bit ULID, and RFC 9562 UUIDv7 generators with zero-allocation stack codecs.
Structs§
- Snowflake
Generator - Lock-free monotonic 64-bit Snowflake ID generator safe for multi-threaded sharing.
- Snowflake
Id - A 64-bit time-ordered Snowflake identifier (
[0 | 41-bit ts | 10-bit node | 12-bit seq]). - Ulid
- A 128-bit lexicographically sortable ULID (
48-bit ms timestamp | 80-bit entropy). - Ulid
Generator - Lock-free monotonic 128-bit ULID generator using atomic state and SplitMix64 entropy.
- UuidV7
- An RFC 9562 time-ordered 128-bit UUIDv7 identifier.
- Uuid
V7Generator - Lock-free monotonic RFC 9562 UUIDv7 generator (
48-bit ts | ver=7 | 12-bit seq | var=10 | 62-bit rnd).
Enums§
- IdError
- Error type returned by Snowflake, ULID, and UUIDv7 constructors and parsers.
Constants§
- DEFAULT_
SNOWFLAKE_ EPOCH_ MS - Default Snowflake custom epoch (
2020-01-01T00:00:00Zin Unix milliseconds). - MAX_
NODE_ ID - Maximum valid 10-bit worker/node identifier (
1023). - MAX_
SEQUENCE - Maximum 12-bit sequence number per millisecond (
4095). - ULID_
STR_ LEN - Exact ASCII byte length of a canonical Crockford Base32 ULID string.
- UUID_
STR_ LEN - Exact ASCII byte length of a hyphenated canonical UUID string.