code wiki / _hdl_build / nx_hub_replicate.nx

nx_hub_replicate.nx

buildroot/runtime/_hdl_build/nx_hub_replicate.nx

2164 B33 linesdepth 6pulls 7 transitivereach 1 importersview sourcekind librarytopic hub
docsdependenciesstructsconstsfunctions

about

nx_hub_replicate.nx -- LIB: HUB-TO-HUB content replication (operator: "hub to hub"). Gossip spreads the INDEX; this pulls the actual BYTES a hub lacks and verifies them fail-closed before trusting. Flow: gossip_select gives the rows this hub is missing -> for each, read the source (the row's url field; live = nx_https_get_stream, gate = a local path) -> recompute SHA-256 and demand it equals the row's content-id -> only then adopt + re-announce. A hub that replicated content becomes a new SOURCE (mesh: A->B, then B->C). Composes nx_dist_publish (content-id) + nx_dist_index (row parsing). Fail-closed integrity = a corrupt/hostile source can never poison the mesh. No TLS. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_dist_publish.nx nx_dist_index.nx nx_syscalls.nx nx_hub_replicate.nx nx_hub_replicate_gate.nx

imports: nx_dist_publish.nxnx_dist_index.nxnx_syscalls.nx

imported by: nx_hub_replicate_gate.nx

structs

none

consts

11const K_MAGIC_1024: i64 = 1024

functions

13func hr_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8) { if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 }
called by 1: hr_verify_replica
15func hr_field(row: *u8, rlen: i64, idx: i64, out: *u8) -> i64
called by 1: hr_replicate_row calls 1: di_tab
22func hr_verify_replica(path: *u8, expected_cid: *u8) -> i64
29func hr_replicate_row(row: *u8, rlen: i64) -> i64