nx_galx_vidoff.nx
buildroot/runtime/nx_galx_vidoff.nx
about
nx_galx_vidoff.nx -- SOVEREIGN O(1) line-offset index for galx_vid_paths.tsv.
The gallery daemon maps daemon-id -> .ts path on EVERY /vid/<id>/* request (poster, init, segs, seg).
Doing that by reading the whole 4.35MB / 62k-line TSV costs ~16ms PER REQUEST (slow /mnt/c 9p) -> it
dominates grid-poster load and seek latency. This builds a compact sidecar so the daemon can seek
straight to line <id>: read 8 bytes at id*8, lseek the TSV, read one line. Two tiny reads, not 4.35MB.
Format (big-endian): tsv_size(8) n(8) then n * off(8) -- off[id] = byte offset of line <id>'s start.
tsv_size is the TSV size at build time = the daemon's freshness check (size changed -> rebuild/fallback).
id is 0-indexed to match gs_vid_line. Idempotent: just rebuild whenever the TSV changes. 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
| none |
functions
| 12 | func w64be(b: *u8, o: i64, v: i64) -> i64 called by 1: main |
| 17 | func pe(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return sys_write(2,s,n) } |
| 18 | func pn(v: i64) -> i64 { var m: i64=v; if m<0{m=0-m} let b: *u8=sys_mmap(32); var i: i64=32; if m==0{i=i-1;b[i]=(48 as u8)} while m>0{let q: i64=m/10; i=i-1; b[i]=((48+(m-q*10)) as u8); m=q} return sys_write(2,((b as i64)+i) as *u8,32-i) } |
| 20 | func main(argc: i64, argv: *i64) -> i64 |