nx_container_registry.nx
buildroot/runtime/nx_container_registry.nx
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
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
structs
| none |
consts
| 24 | const REG_MAGIC_65536: i64 = 65536 |
| 25 | const REG_MAGIC_65535: i64 = 65535 |
| 26 | const REG_MAGIC_131072: i64 = 131072 |
| 27 | const REG_MAGIC_1024: i64 = 1024 |
| 29 | const REG_INDEX: *u8 = "knowledge/containers/registry.index" |
| 30 | const REG_CAS_PFX: *u8 = "knowledge/containers/cas_" |
| 31 | const RT_INDEX: *u8 = "knowledge/containers/rt_registry.index" |
| 32 | const RT_CAS_PFX: *u8 = "knowledge/containers/rt_cas_" |
| 33 | const REG_MAXBLOB: i64 = 1048576 |
functions
| 35 | func 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 } |
| 36 | func rg_wn(fd: i64, v: i64) -> i64 |
| 49 | func rg_p(s: *u8) -> i64 { return rg_w(1, s) } |
| 50 | func rg_pn(v: i64) -> i64 { return rg_wn(1, v) } |
| 51 | func 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 |
| 52 | func rg_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 58 | func rg_read(path: *u8, buf: *u8, cap: i64) -> i64 called by 6: rg_findrg_index_putrg_putrg_getrg_gaterg_cli_list calls 3: sys_openat_rdsys_readsys_close |
| 71 | func rg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 79 | func rg_scpy(dst: *u8, off: i64, s: *u8) -> i64 |
| 85 | func rg_hex(dig: *u8, hexout: *u8) -> i64 |
| 97 | func 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 } |
| 99 | func rg_caspath(out: *u8, pfx: *u8, hex: *u8) -> i64 |
| 108 | func rg_line_name_eq(buf: *u8, off: i64, end: i64, name: *u8) -> i64 |
| 118 | func rg_find(idxpath: *u8, name: *u8, hexout: *u8, szbox: *i64) -> i64 |
| 152 | func rg_index_put(idxpath: *u8, name: *u8, hex: *u8, size: i64) -> i64 |
| 189 | func rg_put(idxpath: *u8, caspfx: *u8, name: *u8, srcpath: *u8) -> i64 |
| 205 | func rg_get(idxpath: *u8, caspfx: *u8, name: *u8, outpath: *u8) -> i64 |
| 224 | func rg_gate() -> i64 |
| 319 | func rg_cli_list() -> i64 |
| 327 | func main(argc: i64, argv: *i64) -> i64 |