code wiki / _hdl_build / nx_dr_dedup.nx
nx_dr_dedup.nx
buildroot/runtime/_hdl_build/nx_dr_dedup.nx
about
nx_dr_dedup.nx -- CAP-DR-DEDUP: content-addressed dedup (store once by hash), the restic/borg space primitive.
For each manifest source: sha256 -> hex; the CAS blob path is <store>/<hex>. If that blob already exists the file
is a DUPLICATE (same content under another name, or an unchanged re-archive) -> stored ZERO extra bytes; else the
blob is written once. An index maps name->hash so restore can reassemble. Composes nx_sha256. Additive (CAS is
write-once-by-hash; a hash collision would need SHA-256 to break). Reports unique blobs + bytes saved.
nx_dr_dedup <manifest> <store-dir>
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_sha256.nxnx_site_lock_lib.nxnx_seg_store.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
| 13 | const DD_MAGIC_262144: i64 = 262144 |
| 14 | const DD_MAGIC_1024: i64 = 1024 |
| 15 | const DD_MAGIC_1536: i64 = 1536 |
| 17 | const DD_CAP: i64 = 67108864 |
functions
| 19 | func dd_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func dd_wn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 25 | func dd_read(path: *u8, out: *u8, cap: i64) -> i64 |
| 31 | func dd_write(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0 - 1 } sys_write(fd, buf, n); sys_close(fd); return n } |
| 32 | func dd_have(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 33 | func dd_join(out: *u8, dir: *u8, name: *u8) -> i64 { var o: i64=0; var i: i64=0; while dir[i]!=(0 as u8){out[o]=dir[i];o=o+1;i=i+1} out[o]=47 as u8; o=o+1; i=0; while name[i]!=(0 as u8){out[o]=name[i];o=o+1;i=i+1} out[o]=0 as u8; return o } called by 1: main |
| 34 | func dd_field(reg: *u8, ls: i64, le: i64, f: i64, out: *u8, cap: i64) -> i64 |
| 40 | func main(argc: i64, argv: *i64) -> i64 |