code wiki / (root) / nx_galx_thumb_migrate.nx

nx_galx_thumb_migrate.nx

buildroot/runtime/nx_galx_thumb_migrate.nx

5095 B104 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic galx
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_galx_thumb_migrate.nx

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

main m_atoi m_mkdir sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close m_p sys_write sys_exit m_one m_path m_exists sys_openat_rd ↻ sys_close ↻ m_unlink sys_openat_rd ↻ sys_read ↻ sys_close ↻ sys_openat_wr sys_write ↻ m_n sys_mmap ↻ sys_write ↻

structs

none

consts

9const M_MAGIC_2048: i64 = 2048
10const M_MAGIC_2000: i64 = 2000
12const M_LOCAL: *u8 = "knowledge/store/galx-thumb/" as *u8
13const M_NAS: *u8 = "/mnt/nas_ai/_galx_thumbs/" as *u8
14const M_BUF: i64 = 2097152 // 2MB reused buffer (thumbs are ~150KB)

functions

16func 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 }
called by 1: main calls 1: sys_write
17func 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 }
called by 1: main calls 2: sys_mmapsys_write
18func 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
20func m_mkdir(path: *u8) -> i64 { return __syscall(258, 0-100, path as i64, 0x1ff, 0, 0, 0) }
called by 1: main
21func m_path(dir: *u8, cid: *u8, out: *u8) -> i64
called by 1: m_one
31func m_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: m_one calls 2: sys_openat_rdsys_close
34func m_one(cid: *u8, buf: *u8, lp: *u8, np: *u8) -> i64
63func main(argc: i64, argv: *i64) -> i64