code wiki / (root) / nx_container_registry.nx

nx_container_registry.nx

buildroot/runtime/nx_container_registry.nx

15988 B351 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic container
docsdependenciesstructsconstsfunctions

about

nx_container_registry.nx -- C2 of the Nishi Container Host: SOVEREIGN content-addressed container REGISTRY (the Docker Hub / OCI distribution analog). Closes the last census MISSING axis (registry_distribution). A container artifact (an emitted governance PE, a spec, any blob) is stored by its SHA-256 DIGEST -- the digest IS the address (content-addressed store / CAS). Two properties fall out BY CONSTRUCTION, which Docker layers bolt on: 1. DEDUP: identical bytes -> identical digest -> ONE blob (a re-put of the same content writes the same address). 2. INTEGRITY: a pull re-hashes the blob and REFUSES it if the bytes no longer match the manifest digest -- a tampered or bit-rotted blob is caught at get time, never silently served (fail-closed, never-brick spirit). A flat manifest (name|digest|size) maps friendly names -> digests (the "tag -> image" index). Pull is BY NAME. CLI: put <name> <srcfile> -> hash + store in CAS + index the name get <name> <outfile> -> resolve name -> digest -> verify -> write (REFUSES on digest mismatch) list -> print the manifest (no args) -> run the self-test GATE (round-trip + tamper-detect + dedup + liar-kill) Store: knowledge/containers/registry.index (manifest) + knowledge/containers/cas_<hex>.blob (CAS blobs). Distribution: the CAS is the on-disk half; P2P distribution rides the LIVE torrent plane (announce a blob's infohash to the DHT, peers pull by digest) -- that wiring is the next rung; the sovereign CAS + integrity is here. NO fake greens: the gate mechanically proves round-trip fidelity + that the integrity check DISCRIMINATES a tamper. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_sha256.nx nx_container_registry.nx

imports: nx_syscalls.nxnx_runtime.nxnx_sha256.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main rg_streq rg_w sys_write rg_put sys_mmap rg_read sys_openat_rd sys_read sys_close sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ rg_hex rg_caspath rg_scpy rg_write sys_openat_wr sys_write ↻ sys_close ↻ rg_index_put sys_mmap ↻ rg_read ↻ rg_line_name_eq rg_strlen rg_scpy ↻ rg_write ↻ rg_p

structs

none

consts

24const REG_MAGIC_65536: i64 = 65536
25const REG_MAGIC_65535: i64 = 65535
26const REG_MAGIC_131072: i64 = 131072
27const REG_MAGIC_1024: i64 = 1024
29const REG_INDEX: *u8 = "knowledge/containers/registry.index"
30const REG_CAS_PFX: *u8 = "knowledge/containers/cas_"
31const RT_INDEX: *u8 = "knowledge/containers/rt_registry.index"
32const RT_CAS_PFX: *u8 = "knowledge/containers/rt_cas_"
33const REG_MAXBLOB: i64 = 1048576

functions

35func rg_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 3: rg_prg_gatemain calls 1: sys_write
36func rg_wn(fd: i64, v: i64) -> i64
called by 2: rg_pnrg_gate calls 2: sys_mmapsys_write
49func rg_p(s: *u8) -> i64 { return rg_w(1, s) }
called by 3: rg_gaterg_cli_listmain calls 1: rg_w
50func rg_pn(v: i64) -> i64 { return rg_wn(1, v) }
called by 2: rg_gatemain calls 1: rg_wn
51func rg_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: rg_line_name_eq
52func rg_streq(a: *u8, b: *u8) -> i64
called by 1: main
58func rg_read(path: *u8, buf: *u8, cap: i64) -> i64
71func rg_write(path: *u8, buf: *u8, n: i64) -> i64
79func rg_scpy(dst: *u8, off: i64, s: *u8) -> i64
85func rg_hex(dig: *u8, hexout: *u8) -> i64
called by 3: rg_putrg_getrg_gate
97func rg_hexeq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while i < 64 { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 2: rg_getrg_gate
99func rg_caspath(out: *u8, pfx: *u8, hex: *u8) -> i64
called by 3: rg_putrg_getrg_gate calls 1: rg_scpy
108func rg_line_name_eq(buf: *u8, off: i64, end: i64, name: *u8) -> i64
called by 2: rg_findrg_index_put calls 1: rg_strlen
118func rg_find(idxpath: *u8, name: *u8, hexout: *u8, szbox: *i64) -> i64
152func rg_index_put(idxpath: *u8, name: *u8, hex: *u8, size: i64) -> i64
189func rg_put(idxpath: *u8, caspfx: *u8, name: *u8, srcpath: *u8) -> i64
205func rg_get(idxpath: *u8, caspfx: *u8, name: *u8, outpath: *u8) -> i64
224func rg_gate() -> i64
319func rg_cli_list() -> i64
called by 1: main calls 4: sys_mmaprg_readrg_psys_write
327func main(argc: i64, argv: *i64) -> i64