code wiki / _hdl_build / nx_adnet_recbeat.nx

nx_adnet_recbeat.nx

buildroot/runtime/_hdl_build/nx_adnet_recbeat.nx

8208 B168 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind tooltopic adnet
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_adnet_reconcile.nx nx_adnet_recbeat.nx

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

main arb_dryrun sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close arb_puts sys_write arec_refresh sys_mmap ↻ ad_eol aslot_field_b ad_tab aslot_id_ok ainv_spent_milli aslot_id_ok ↻ ainv_rate sys_mmap ↻ ad_eol ↻ aslot_field_b ↻ ainv_num ad_event_count ad_slen ad_eol ↻ anb_total_milli arec_row_with_spend ad_tab ↻ arec_catd sys_mmap ↻ arb_pn sys_mmap ↻ sys_write ↻ sys_write ↻ sys_mmap ↻ sys_read_file ↻ arb_puts ↻ arec_refresh ↻

structs

none

consts

21const ARB_CAMPS: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf" as *u8
22const ARB_TMP: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf.new" as *u8
23const ARB_PREV: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_campaigns.conf.prev" as *u8
24const ARB_RATES: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_rates.conf" as *u8
25const ARB_SERVED:*u8 = "/volume1/homes/elderwesto/nishihost/adnet_impressions.log" as *u8
26const ARB_CLICKS:*u8 = "/volume1/homes/elderwesto/nishihost/adnet_clicks.log" as *u8
27const ARB_VIEW: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/adnet_viewable.log" as *u8
28const ARB_CAP: i64 = 1048576

functions

30func 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 }
called by 2: arb_dryrunmain calls 1: sys_write
31func arb_pn(v: i64) -> i64
called by 2: arb_dryrunmain calls 2: sys_mmapsys_write
48func arb_dryrun(argv: *i64) -> i64
83func main(argc: i64, argv: *i64) -> i64