code wiki / _hdl_build / nx_library_cache.nx

nx_library_cache.nx

buildroot/runtime/_hdl_build/nx_library_cache.nx

3412 B78 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic library
docsdependenciesstructsconstsfunctions

about

nx_library_cache.nx -- RESILIENCE: mirror external sources INTO the Nishi Library so that when sites start blocking bot traffic we are not left without the information. The Researcher prefers the LOCAL library; it fetches external only to FILL A GAP, then DOWNLOADS (mirrors) the bytes to disk so the next read is sovereign. Over time we parse more and more of our OWN library and depend on the open web less. Same extractor (nx_research_extract) parses local mirrors and live fetches identically. lc_mirror -- download a fetched source into the library (persist to disk) lc_have_local -- is this source already mirrored? (no network needed) lc_read_mirror -- read a mirrored source back for parsing lc_route -- LOCAL (preferred) / EXTERNAL (fetch+mirror) / BLOCKED (no mirror, unreachable) lc_should_mirror -- FLAG a source to pull into the library (citeable + not yet local) lc_resilience_permil / lc_self_sufficient -- how bot-block-proof our knowledge is license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_library_cache.nx nx_library_search_test.nx nx_research_resilience_test.nx

imports: nx_syscalls.nx

imported by: nx_library_search_test.nxnx_research_resilience_test.nx

structs

none

consts

17const LC_LOCAL: i64 = 1 // mirrored -> answer from the library, zero network
18const LC_EXTERNAL: i64 = 2 // not mirrored but reachable -> fetch THEN mirror
19const LC_BLOCKED: i64 = 3 // not mirrored AND unreachable -> we are starved (this is what mirroring prevents)

functions

22func lc_mirror(path: *u8, data: *u8, n: i64) -> i64
32func lc_have_local(path: *u8) -> i64
called by 1: main calls 2: sys_openat_rdsys_close
40func lc_read_mirror(path: *u8, out: *u8, cap: i64) -> i64
55func lc_route(have_local: i64, external_reachable: i64) -> i64
called by 1: main
62func lc_should_mirror(have_local: i64, is_citeable: i64) -> i64
called by 1: main
69func lc_resilience_permil(total: i64, mirrored: i64) -> i64
called by 1: main
75func lc_self_sufficient(total: i64, mirrored: i64) -> i64