nx_galx_thumb_migrate.nx
buildroot/runtime/nx_galx_thumb_migrate.nx
about
nx_galx_thumb_migrate.nx -- SOVEREIGN move of the thumbnail cache from local disk to the NAS, so the
thumbs live on the NAS (159TB) instead of eating local C:. For each CID in the view index it copies
knowledge/store/galx-thumb/<cid>.png -> /mnt/nas_ai/_galx_thumbs/<cid>.png then unlinks the local copy.
Idempotent: a CID already on the NAS is skipped. Uses ONE reused read buffer (no per-file mmap -> no
leak, no fork needed). Run several instances over disjoint ranges (launcher) for parallel throughput;
CIDs never overlap so there is no contention. Usage: nx_galx_thumb_migrate <start> <count>.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 9 | const M_MAGIC_2048: i64 = 2048 |
| 10 | const M_MAGIC_2000: i64 = 2000 |
| 12 | const M_LOCAL: *u8 = "knowledge/store/galx-thumb/" as *u8 |
| 13 | const M_NAS: *u8 = "/mnt/nas_ai/_galx_thumbs/" as *u8 |
| 14 | const M_BUF: i64 = 2097152 // 2MB reused buffer (thumbs are ~150KB) |
functions
| 16 | func m_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 17 | func m_n(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 } |
| 18 | func m_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ if s[i]>=(48 as u8){ if s[i]<=(57 as u8){ v=v*10+((s[i]-(48 as u8)) as i64) } } i=i+1 } return v } called by 1: main |
| 19 | func m_unlink(path: *u8) -> i64 { return __syscall(263, 0-100, path as i64, 0, 0, 0, 0) } // unlinkat(AT_FDCWD,path,0) called by 1: m_one |
| 20 | func m_mkdir(path: *u8) -> i64 { return __syscall(258, 0-100, path as i64, 0x1ff, 0, 0, 0) } called by 1: main |
| 21 | func m_path(dir: *u8, cid: *u8, out: *u8) -> i64 called by 1: m_one |
| 31 | func m_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 34 | func m_one(cid: *u8, buf: *u8, lp: *u8, np: *u8) -> i64 |
| 63 | func main(argc: i64, argv: *i64) -> i64 |