code wiki / _hdl_build / nx_web_archive.nx

nx_web_archive.nx

buildroot/runtime/_hdl_build/nx_web_archive.nx

10863 B182 linesdepth 2pulls 2 transitivereach 10 importersview sourcekind librarytopic web
docsdependenciesstructsconstsfunctions

about

nx_web_archive.nx -- SOVEREIGN WARC-class archive store: the link-rot-prevention core. Preserve a captured resource (URL + content-type + bytes) as a WARC record, and retrieve it by URL later -- so when the origin site vanishes (abandonware, dead host), the search engine serves the PRESERVED copy instead of a 404. WARC (ISO 28500) is the exact format the Internet Archive + Browsertrix use, so ours interoperates. A WARC is a sequence of records: a text header block (WARC/1.0 + fields) then a Content-Length-delimited payload (so BINARY media with embedded CRLF round-trips exactly). We write "resource" records (payload = the raw bytes). license_tier: ORIGINAL

dependencies 1 imports · 10 importers

nx_syscalls.nx nx_web_archive.nx nx_archive_capture.nx nx_archive_capture_gate.nx nx_archive_daemon.nx nx_archive_live.nx nx_archive_resolve.nx nx_archive_resolve_gate.nx nx_bench_warc.nx nx_crawl_preserve.nx nx_preserve_live.nx nx_web_archive_gate.nx

imports: nx_syscalls.nx

imported by: nx_archive_capture.nxnx_archive_capture_gate.nxnx_archive_daemon.nxnx_archive_live.nxnx_archive_resolve.nxnx_archive_resolve_gate.nxnx_bench_warc.nxnx_crawl_preserve.nxnx_preserve_live.nxnx_web_archive_gate.nx

structs

none

consts

none

functions

10func wa_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
11func wa_puts(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off]=s[i];off=off+1;i=i+1} return off }
12func wa_putn(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; if m==0 { dst[off]=48 as u8; return off+1 } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } var j: i64=0; while j<k { dst[off]=t[k-1-j]; off=off+1; j=j+1 } return off }
13func wa_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64
21func wa_write_resource(buf: *u8, off: i64, uri: *u8, date: *u8, ctype: *u8, payload: *u8, plen: i64) -> i64
35func wa_field_num(warc: *u8, start: i64, end: i64, field: *u8) -> i64
46func wa_uri_matches(warc: *u8, start: i64, end: i64, uri: *u8, ulen: i64) -> i64
called by 2: wa_lookupwa_resolve calls 1: wa_find
62func wa_lookup(warc: *u8, warclen: i64, uri: *u8, ulen: i64, out_ptr: *i64, out_len: *i64) -> i64
85func wa_content_type(warc: *u8, start: i64, end: i64, out: *u8, cap: i64) -> i64
called by 2: wa_resolvewa_record_at calls 1: wa_find
96func wa_resolve(warc: *u8, warclen: i64, uri: *u8, ulen: i64, out_ptr: *i64, out_len: *i64, out_ctype: *u8, ctcap: i64) -> i64
119func wa_count(warc: *u8, warclen: i64) -> i64
called by 3: ad_homemainmain calls 1: wa_find
126func wa_save(path: *u8, warc: *u8, warclen: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0-1 } sys_write(fd, warc, warclen); sys_close(fd); return 0 }
127func wa_load(path: *u8, warc: *u8, cap: i64) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } let n: i64 = sys_read(fd, warc, cap); sys_close(fd); return n }
131func wa_write_resource_rated(buf: *u8, off: i64, uri: *u8, date: *u8, ctype: *u8, rating: *u8, payload: *u8, plen: i64) -> i64
calls 2: wa_putswa_putn
145func wa_hdr_str(warc: *u8, start: i64, end: i64, field: *u8, out: *u8, cap: i64) -> i64
155func wa_target_uri(warc: *u8, start: i64, end: i64, out: *u8, cap: i64) -> i64 { return wa_hdr_str(warc, start, end, "WARC-Target-URI: " as *u8, out, cap) }
called by 1: wa_record_at calls 1: wa_hdr_str
157func wa_rating(warc: *u8, start: i64, end: i64, out: *u8, cap: i64) -> i64
called by 1: wa_record_at calls 1: wa_hdr_str
163func wa_record_at(warc: *u8, warclen: i64, index: i64, out_uri: *u8, uricap: i64, out_ct: *u8, ctcap: i64, out_rating: *u8, rcap: i64, out_len: *i64) -> i64