Appearance
Identifier layouts (frozen for 1.x)
These bit layouts are part of the JASE.IdGenerator contract. Changing them would make existing stored ids incomparable. Do not change them in a 1.x release.
Types live in the JASE namespace. UuidFactory / UlidFactory / UuidConfig are process-wide (one monotonic counter per facade). Construct UuidGenerator / UlidGenerator when two libraries in one process must not share state, or when many threads mint as fast as possible (one instance per thread).
TryConvertToSqlComb / TryConvertToV7 rewrite the same timestamp and entropy between RFC v7 and this COMB layout. The Guid value changes (version nibble and byte placement). GetPrimaryKey is not preserved (12-bit vs 14-bit ordered field).
UUIDv7 (RFC 9562)
Big-endian RFC bytes:
| Bytes | Content |
|---|---|
| 0..5 | 48-bit Unix millisecond timestamp |
| 6..7 | Version nibble 7 + 12-bit rand_a (counter, or 4-bit node + 8-bit counter when node mode is on) |
| 8..15 | RFC 4122 variant 10 + random tail |
Throughput: 4,096 ids/ms without node mode; 256 ids/ms per node with node mode (node id 0..15).
PostgreSQL (UuidType.Postgres / GenerateForPostgreSql) uses this layout. There is no distinct Postgres bit pattern.
SQL Server COMB (RFC 9562 version 8)
SQL Server sorts uniqueidentifier on a swapped byte order. JASE stores the timestamp in the high-order sort bytes and stamps version 8 so COMBs never collide with v7 detection.
| Bytes (RFC / big-endian) | Content |
|---|---|
| 0..7 | Random entropy; byte 6 version nibble is 8 |
| 8..9 | RFC 4122 variant 10 + 14-bit ordered payload (counter, or 4-bit node + 10-bit counter) |
| 10..15 | 48-bit Unix millisecond timestamp |
Throughput: 16,384 ids/ms without node mode; 1,024 ids/ms per node with node mode.
GetPrimaryKey
64-bit value: (timestamp48 << 16) \| ordered16.
The UUID random tail is discarded. Uniqueness:
| Deployment | Requirement |
|---|---|
| Single process | Safe as-is |
| ≤16 writers | UuidConfig.SetUseNode(true) and distinct node ids 0..15 |
| More writers | OrderedIdGenerator — do not use GetPrimaryKey as a distributed id |
Node mode is not detectable from a GUID after the fact. The decoder cannot reject a key that was minted without node embedding.
Snowflake (OrderedIdGenerator)
timestamp(41) \| node(10) \| sequence(12).
Epoch: OrderedIdGenerator.DefaultEpoch = 2025-07-11 00:00:00 UTC. Encoded timestamps are milliseconds since that instant. A Unix-epoch snowflake would overflow around 2039; this origin lasts into the 2090s. Do not change DefaultEpoch in 1.x.
TwitterEpoch (2010-11-04 01:42:54.657 UTC) is the Twitter / IdGen origin for interop. Pass it as epochUtc when constructing the generator; mint and decode must share that epoch. Use WallClock if decoded timestamps must match wall UTC. Node ids still must not collide.
Construct with an explicit nodeId (0..1023). FromEnvironment() reads JASE_ID_GENERATOR_NODE and throws if it is missing.