code wiki / _hdl_build / nx_ad_meter.nx

nx_ad_meter.nx

buildroot/runtime/_hdl_build/nx_ad_meter.nx

4401 B97 linesdepth 4pulls 7 transitivereach 10 importersview sourcekind librarytopic ad
docsdependenciesstructsconstsfunctions

about

nx_ad_meter.nx -- LIB: per-advertiser FIRST-PARTY outcome MEASUREMENT for the "Brought to you by" performance ad engine (ADS-007, CALLOUT-004). The keystone that turns honest measurement into a billable verdict. NO-FLOATING: composes the two DONE foundations -- conversions via nx_ad_conversion (ADS-018: consent-gate -> bot-filter -> aggregate -> k-anon) and impressions via nx_ad_botfilter (ADS-019) -- and reads the goal target + exceed multiple from the SOVEREIGN STORE (ADS-006 schema: adgoal:/adpricing:), never TSV. THE VERDICT (per campaign-period, measured against THEIR chosen goal target): UNDER result < target -> downstream bill = $0 PERFORM target <= result < target*exceed_mult -> flat perform fee EXCEED result >= target*exceed_mult -> flat fee + ONE flat capped bonus HONEST-BILLING LAW MADE LOAD-BEARING: if the target or exceed_mult is not a real number yet (PENDING-CENSUS / PENDING-COSPEC in the store -- figures are sponsor co-spec, ADS-005/ADS-001), the meter returns UNMEASURABLE. "We cannot bill what we cannot measure" -- the default is no charge, and a verdict requires real, store-resident figures. license_tier: ORIGINAL

dependencies 5 imports · 3 importers

nx_ad_conversion.nx nx_ad_botfilter.nx nx_kanon.nx nx_ad_store.nx nx_syscalls.nx nx_ad_meter.nx nx_ad_bill.nx nx_ad_meter_gate.nx nx_ad_offering.nx

imports: nx_ad_conversion.nxnx_ad_botfilter.nxnx_kanon.nxnx_ad_store.nxnx_syscalls.nx

imported by: nx_ad_bill.nxnx_ad_meter_gate.nxnx_ad_offering.nx

structs

none

consts

23const AM_UNMEASURABLE: i64 = 0 - 1
24const AM_UNDER: i64 = 0
25const AM_PERFORM: i64 = 1
26const AM_EXCEED: i64 = 2

functions

31func am_field_int(val: *u8, vlen: i64, fi: i64) -> i64
56func am_target_of(goal_key: *u8) -> i64
65func am_exceed_mult_of(price_key: *u8) -> i64
called by 1: main calls 3: sys_mmapads_getam_field_int
74func am_verdict(result: i64, target: i64, exceed_mult: i64) -> i64
called by 1: main
85func am_result_conversions(ev: *i64, m: i64, rules: *i64, nrules: i64, k: i64) -> i64
called by 1: main calls 1: cv_release
92func am_result_impressions(ev: *i64, m: i64, rules: *i64, nrules: i64) -> i64