nx_ingest.nx
buildroot/runtime/nx_ingest.nx
about
nx_ingest.nx -- MLIB-004 (CALLOUT-012). The INGESTION SOURCE-ADAPTER FRAMEWORK.
DATA-DRIVEN + GROWABLE: reads knowledge/registry/media_sources.tsv (a new endpoint = a row),
builds source_id -> drm_policy. The uniform adapter contract per item:
1. POLICY: look up the item's source policy; if not "drm-free" -> REFUSE (no DRM
circumvention -- the hard line, gate RED-fails any DRM source ingest).
2. FINGERPRINT: content CID via nx_canon_cid cid_of (= MLIB-003 dedup key).
3. IDEMPOTENT INGEST (rule 10): if the fingerprint was already seen -> DEDUP-skip, else ingest.
Live external fetch (Humble/Fanatical/... over their APIs) rides the sovereign HTTP stack once
the external-HTTPS TLS-FIN gap clears (X-CENSUS-003); here the contract+policy+dedup is proven
on a deterministic local fixture. Self-validating gate (INGESTGATE): two-pass idempotency +
DRM-refused hard line + content-dedup. license_tier: ORIGINAL
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_canon_cid.nx
imported by: nx_conflict.nxnx_descriptor.nxnx_emit.nxnx_ingest_gate.nxnx_register.nxnx_write_exceed_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const IN_MAGIC_20000: i64 = 20000 |
| 16 | const IN_MAXS: i64 = 64 |
| 17 | const IN_REG: *u8 = "knowledge/registry/media_sources.tsv" |
functions
| 19 | func in_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 20 | func in_putn(v: i64) -> i64 { let bb: *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); m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(1, bb, k); return 0 } |
| 21 | func in_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: in_classify |
| 23 | func in_read_file(path: *u8, buf: *u8, cap: i64) -> i64 |
| 32 | func in_scan(buf: *u8, n: i64, start: i64, delim: i64) -> i64 { var i: i64 = start; var s: i64 = 1; while s == 1 { if i >= n { s = 0 } else { if buf[i] == (delim as u8) { s = 0 } else { i = i + 1 } } } return i } called by 1: in_parse_reg |
| 35 | func in_parse_reg(buf: *u8, blen: i64, sid: *i64, spol: *i64) -> i64 |
| 57 | func in_policy_of(sid: *i64, spol: *i64, ns: i64, src: *u8) -> i64 |
| 63 | func in_seen(seen: *i64, ns: i64, fp: *u8) -> i64 { var i: i64 = 0; while i < ns { if cc_cmp((seen[i]) as *u8, fp) == 0 { return 1 } i = i + 1 } return 0 } |
| 66 | func in_classify(src: *u8, content: *u8, sid: *i64, spol: *i64, ns: i64, seen: *i64, nseen: *i64) -> i64 |
| 79 | func in_run(N: i64, srcA: *i64, conA: *i64, sid: *i64, spol: *i64, ns: i64, seen: *i64, nseen: *i64, counts: *i64, verbose: i64) -> i64 |
| 92 | func main() -> i64 |