nx_lib_fetch_ingest.nx source
↩ module page · 18 lines · 968 B
1// nx_lib_fetch_ingest.nx -- the FULL sovereign ingest: fetch a work URL over
2// TLS-1.3 (nx_lib_fetch) -> parse + store (nx_lib_ingest_json). One call
3// replaces the entire Python httpx+json+pydantic+sqlite ingest path. The
4// deterministic tail is gated in nx_lib_ingest_json_test; the fetch is
5// network-gated (ready the moment the LAN/NAS is reachable).
6// license_tier: ORIGINAL | genealogy_id: nishi_library_sovereign_fetch_ingest_2026_07_01
7import "nx_lib_fetch.nx"
8import "nx_lib_ingest_json.nx"
9const K_MAGIC_4194304: i64 = 4194304
10
11// fetch url over sovereign TLS, parse the work JSON, store under hk.
12// returns the stored record length, or a negative fetch/parse error.
13func nx_lib_fetch_ingest(store: *TrustStore, url: *u8, hk: *u8, hklen: i64) -> i64 {
14 let buf: *u8 = sys_mmap(K_MAGIC_4194304)
15 let gc: i64 = nx_lib_fetch(store, url, buf, K_MAGIC_4194304)
16 if gc < 0 { return gc }
17 return nx_lib_ingest_json_response(buf, gc, hk, hklen)
18}