code wiki / _hdl_build / nx_ha_replication.nx

nx_ha_replication.nx

buildroot/runtime/_hdl_build/nx_ha_replication.nx

2867 B49 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic ha
docsdependenciesstructsconstsfunctions

about

nx_ha_replication.nx -- CAP-HA-REPLICATION: append-only log-shipping replication (WAL-style) to kill the DATA SPOF (the single NAS). The primary appends records; rep_ship copies new bytes to a standby/backup so it holds a BYTE-EXACT prefix of the primary. Usable TODAY as backup/DR (single-node), and the sync target when a standby host exists. Append-only = history sacred (never rewrites). Deterministic; rep_in_sync proves byte-identity, rep_lag measures how far behind the replica is. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_ha_replication.nx nx_ha_chaos_gate.nx nx_ha_replication_gate.nx

imports: nx_syscalls.nx

imported by: nx_ha_chaos_gate.nxnx_ha_replication_gate.nx

structs

none

consts

7const K_MAGIC_1048576: i64 = 1048576

functions

10func rep_position(path: *u8) -> i64
17func rep_append(path: *u8, record: *u8, n: i64) -> i64
22func rep_read_all(path: *u8, out: *u8, cap: i64) -> i64
29func rep_ship(primary: *u8, standby: *u8, from_pos: i64) -> i64
40func rep_lag(primary: *u8, standby: *u8) -> i64 { return rep_position(primary) - rep_position(standby) }
called by 1: main calls 1: rep_position
42func rep_in_sync(primary: *u8, standby: *u8) -> i64
called by 2: mainmain calls 2: sys_mmaprep_read_all