nx_uuid.nx
buildroot/runtime/nx_uuid.nx
about
nx_uuid.nx -- RFC 4122 UUIDv4 + RFC 9562 UUIDv7.
Used by:
- Distributed log correlation (request IDs)
- Database row primary keys (when an external system needs
them before insert)
- Cache key generation
UUIDv4 is fully random (122 bits of entropy + 6 fixed bits).
UUIDv7 is timestamp-prefixed (48 bits Unix-ms timestamp + 74 bits
of entropy + 6 fixed bits) -- sortable by creation time, which
makes B-tree primary keys 100x faster on insert than v4.
Both are 128-bit values rendered as
"xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" where M = version digit
(4 or 7) and N's high 2 bits are 10 (RFC variant marker).
We accept any nx_rng for the entropy source. v7 uses
gettimeofday() for the timestamp.
Pairs with nx_random (entropy) + nx_strconv (hex output).
dependencies 2 imports · 0 importers
imports: syscalls.nxnx_random.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const K_MAGIC_12345: i64 = 12345 |
functions
| 35 | func nx_uuid_render(b: *u8, out: *u8) -> i64 called by 1: main |
| 72 | func nx_uuid_v4(rng: *NxRng, b: *u8) -> i64 |
| 88 | func nx_uuid_v7(rng: *NxRng, b: *u8) -> i64 |
| 116 | func main() -> i64 |