code wiki / _hdl_build / nx_adnet_recbeat.nx
nx_adnet_recbeat.nx
buildroot/runtime/_hdl_build/nx_adnet_recbeat.nx
about
nx_adnet_recbeat.nx -- THE BEAT: refresh campaign spend (field 7) from the measured journals.
nx_adnet_reconcile is a PURE transform with no IO so it stays gateable; this is the thin runner that
owns the dangerous half -- reading the confs and replacing a live file. Keeping that in one small,
reviewable organ is the point of the split.
★ ATOMIC BY CONSTRUCTION: write a temp beside the target, then rename. A half-written campaign conf is
a serving outage -- every paid campaign would read as malformed and stop serving at once. rename(2)
on the same filesystem is the only step that touches the live path.
★ NEVER-BRICK: the previous conf is banked as .prev before the swap, and EVERY refusal below leaves the
live file byte-untouched. An absent campaigns conf is NOT an error -- it means no paid campaigns yet,
and the beat exits 0 having done nothing.
★ FAIL-LOUD ON A SHRINKING CONF: if the refreshed output is materially smaller than the input, something
was dropped and we REFUSE to install it. A reconciler that silently truncates the file it maintains is
the worst outcome here, so the size check is a hard gate rather than a warning.
run: nx_adnet_recbeat (paths are compiled in; no argv, so a cron row cannot mis-target it)
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_adnet_reconcile.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 21 | const ARB_CAMPS: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf" as *u8 |
| 22 | const ARB_TMP: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf.new" as *u8 |
| 23 | const ARB_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf.prev" as *u8 |
| 24 | const ARB_RATES: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_rates.conf" as *u8 |
| 25 | const ARB_SERVED:*u8 = "/volume1/homes/elderwesto/nishihost/adnet_impressions.log" as *u8 |
| 26 | const ARB_CLICKS:*u8 = "/volume1/homes/elderwesto/nishihost/adnet_clicks.log" as *u8 |
| 27 | const ARB_VIEW: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_viewable.log" as *u8 |
| 28 | const ARB_CAP: i64 = 1048576 |
functions
| 30 | func arb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 31 | func arb_pn(v: i64) -> i64 |
| 48 | func arb_dryrun(argv: *i64) -> i64 |
| 83 | func main(argc: i64, argv: *i64) -> i64 |