code wiki / (root) / nx_uuid.nx

nx_uuid.nx

buildroot/runtime/nx_uuid.nx

5535 B155 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

syscalls.nx nx_random.nx nx_uuid.nx

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

main nx_rng_new nx_rng_splitmix nx_uuid_v4 nx_rng_fill nx_rng_next nx_rng_rotl nx_uuid_v7 nx_rng_fill ↻ nx_uuid_render

structs

none

consts

31const K_MAGIC_12345: i64 = 12345

functions

35func nx_uuid_render(b: *u8, out: *u8) -> i64
called by 1: main
72func nx_uuid_v4(rng: *NxRng, b: *u8) -> i64
called by 1: main calls 1: nx_rng_fill
88func nx_uuid_v7(rng: *NxRng, b: *u8) -> i64
called by 1: main calls 1: nx_rng_fill
116func main() -> i64