code wiki / _hdl_build / nx_cc_warc_ingest.nx
nx_cc_warc_ingest.nx
buildroot/runtime/_hdl_build/nx_cc_warc_ingest.nx
about
nx_cc_warc_ingest.nx -- BULK Common Crawl ingester: a LOCAL .warc.gz file -> the dp-web-pub- web shard.
SCALE rung over nx_cc_ingest (one network round-trip per record): here ONE pre-downloaded WARC file
(~1GB, ~30-40k pages; each CC record = its own gzip member) is stream-walked member-by-member ->
'response' records -> HTTP 200 + text/html -> html->text -> quality filters -> ss_add doc:/url:/loc:
rows + out: edges (same node identity as the crawler/serve, so every page feeds PageRank).
BATCH+RESUME BY CONSTRUCTION: the deflate path allocates interior mappings it cannot free, so one
process walks at most <maxmembers> members starting at the byte offset checkpointed in <localfile>.off,
commits its segments, rewrites the checkpoint, exits. A driver loops invocations until DONE prints.
(Also crash-safe: a killed batch never advances the checkpoint past committed work.)
usage: nx_cc_warc_ingest <localfile> <cc-warc-path> [maxmembers]
<cc-warc-path> = the crawl-data/... path the file came from; stored in loc: rows for the rot-fallback,
byte-offset-exact, so a served result can re-range-fetch its record just like nx_cc_ingest's rows.
exit 0 = batch clean (prints MORE nextoff=N or DONE, + verdict=PASS) ; nonzero = failure, checkpoint
NOT advanced past the bad byte (surface corruption, never silently skip). license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_corpus_ingest.nxnx_gzip_wrap.nxnx_warc_reader.nxnx_outlink_harvest.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
| 19 | const CWI_MAGIC_1152: i64 = 1152 |
| 20 | const CWI_MAGIC_8192: i64 = 8192 |
| 21 | const CWI_MAGIC_1048576: i64 = 1048576 |
| 22 | const CWI_MAGIC_2048: i64 = 2048 |
| 23 | const CWI_MAGIC_2400: i64 = 2400 |
| 29 | const CWI_WINDOW: i64 = 134217728 // read window per batch (128MiB) |
| 30 | const CWI_MAXMEM: i64 = 12000 // default members per batch |
| 31 | const CWI_RECCAP: i64 = 33554432 // largest single inflated WARC record accepted: a <=2MB compressed |
| 34 | const CWI_SEGCAP: i64 = 16777216 // 16MiB writer segments: serve cost grows with segment COUNT, so big |
| 36 | const CWI_MINTEXT: i64 = 400 // min extracted BYTES: kills nav-chrome stubs + soft-404s at ingest |
| 42 | const CWI_SCANSPAN: i64 = 4096 // classification window (bytes) |
| 43 | const CWI_MINMASS: i64 = 150 // min weighted word-char count in the window |
| 44 | const CWI_CJKW: i64 = 2 // CJK char weight in the mass sum |
| 45 | const CWI_MAXURL: i64 = 1500 // == OLH_MAXURL policy: longer urls are tracker/junk, skip the page |
functions
| 47 | func cw_puts(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 |
| 48 | func cw_num(v: i64) -> i64 called by 1: main |
| 57 | func cw_atoin(s: *u8, n: i64) -> i64 |
| 63 | func cw_cntsub(hay: *u8, n: i64, lit: *u8, litlen: i64) -> i64 called by 1: cw_hassub |
| 73 | func cw_hassub(hay: *u8, n: i64, lit: *u8, litlen: i64) -> i64 |
| 80 | func cw_scriptmass(t: *u8, n: i64, counts: *i64) -> i64 |
| 106 | func cw_lngkey(cid: i64, out: *u8) -> i64 called by 1: main |
| 115 | func cw_lockey(cid: i64, out: *u8) -> i64 called by 1: main |
| 123 | func cw_readoff(path: *u8) -> i64 |
| 133 | func cw_writeoff(path: *u8, v: i64) -> i64 |
| 147 | func main(argc: i64, argv: *i64) -> i64 |