code wiki / _hdl_build / nx_library_cache.nx
nx_library_cache.nx
buildroot/runtime/_hdl_build/nx_library_cache.nx
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
imports: nx_syscalls.nx
imported by: nx_library_search_test.nxnx_research_resilience_test.nx
structs
| none |
consts
| 17 | const LC_LOCAL: i64 = 1 // mirrored -> answer from the library, zero network |
| 18 | const LC_EXTERNAL: i64 = 2 // not mirrored but reachable -> fetch THEN mirror |
| 19 | const LC_BLOCKED: i64 = 3 // not mirrored AND unreachable -> we are starved (this is what mirroring prevents) |
functions
| 22 | func lc_mirror(path: *u8, data: *u8, n: i64) -> i64 |
| 32 | func lc_have_local(path: *u8) -> i64 |
| 40 | func lc_read_mirror(path: *u8, out: *u8, cap: i64) -> i64 |
| 55 | func lc_route(have_local: i64, external_reachable: i64) -> i64 called by 1: main |
| 62 | func lc_should_mirror(have_local: i64, is_citeable: i64) -> i64 called by 1: main |
| 69 | func lc_resilience_permil(total: i64, mirrored: i64) -> i64 called by 1: main |
| 75 | func lc_self_sufficient(total: i64, mirrored: i64) -> i64 |