code wiki / _hdl_build / nx_dr_archive.nx

nx_dr_archive.nx

buildroot/runtime/_hdl_build/nx_dr_archive.nx

7240 B114 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind tooltopic dr
docsdependenciesstructsconstsfunctions

about

nx_dr_archive.nx -- CAP-DR-ARCHIVE: sovereign disaster-recovery archiving. Copies critical NAS state to a SEPARATE device (a local drive that is NOT the NAS) + verifies BYTE-IDENTITY + records a sha256 receipt -- killing the DATA SPOF without a failover host. Data-driven: a manifest (source-path <TAB> archive-name) is the SSOT of what to protect. Composes rep_in_sync (byte-identity proof), nx_sha256 (integrity fingerprint), slk_* (manifest parse). Idempotent (each run = a fresh, verified snapshot). Additive-safe: READS the NAS, WRITES only the archive dir. argv: [1]=manifest-path [2]=archive-dir (on a separate drive, e.g. /mnt/d/nishi-archive) license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_site_lock_lib.nx nx_sha256.nx nx_seg_store.nx nx_dr_archive.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_site_lock_lib.nxnx_sha256.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

main ar_w sys_write sys_exit sys_mkdir sys_mmap ar_read sys_openat_rd sys_read sys_close ar_join ss_next_segid sys_mmap ↻ ss_cat ss_readall sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻ ss_segid_ok ss_begin ss_begin_cap sys_mmap ↻ slk_line_end ar_field sys_mmap ↻ slk_field ar_write sys_openat_wr sys_write ↻ sys_close ↻ ar_eq sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks

structs

none

consts

13const AR_MAGIC_262144: i64 = 262144
14const AR_MAGIC_1024: i64 = 1024
15const AR_MAGIC_1536: i64 = 1536
17const AR_CAP: i64 = 67108864 // 64 MiB/file cap (crown jewels are small; large media is a later tier)

functions

19func ar_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
24func ar_wn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
25func ar_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
28func ar_read(path: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
35func ar_write(path: *u8, buf: *u8, n: i64) -> i64
40func ar_join(out: *u8, dir: *u8, name: *u8) -> i64
called by 1: main
47func ar_field(reg: *u8, ls: i64, le: i64, f: i64, out: *u8, cap: i64) -> i64
called by 1: main calls 2: sys_mmapslk_field
53func ar_eq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 1: main
55func main(argc: i64, argv: *i64) -> i64