code wiki / (root) / nx_rights_ledger.nx

nx_rights_ledger.nx

buildroot/runtime/nx_rights_ledger.nx

6752 B182 linesdepth 2pulls 2 transitivereach 12 importersview sourcekind librarytopic rights
docsdependenciesstructsconstsfunctions

about

nx_rights_ledger.nx -- the rights/consent spine for licensed talent likeness + media (the DMS keystone). THE predicate: nx_rights_is_licensed(talent, use, now) -> 1 allow / 0 deny default-DENY: a use is permitted ONLY when a current, unexpired, unrevoked grant for that EXACT (talent, use_scope) exists. Models a real licensing contract -- a grant carries a term (expires_us) and a use-scope (what was licensed); revocation supersedes a grant; the grant row is NEVER erased (ADDITIVE law #13 -- it stays as the audit trail). Unknown talent, unknown use, expired, and revoked all DENY by construction. Mirrors the proven nx_trace_consent state machine (propose/decide/check -> grant/revoke/is_licensed) with licensing-specific use scopes. RUNG 1 (this file): semantics, in-memory. RUNG 2 (flagged, NOT a silent cap): persist each row through nx_canon_cid -> nx_seg_store for the durable never-lose audit trail on the NAS. license_tier: ORIGINAL

dependencies 2 imports · 10 importers

nx_syscalls.nx nx_tier.nx nx_rights_ledger.nx nx_dms_catalog.nx nx_dms_catalog_gate.nx nx_dms_catalog_store_gate.nx nx_dms_search.nx nx_dms_search_gate.nx nx_dms_search_store_gate.nx nx_offer_ledger_gate.nx nx_rights_ledger_gate.nx nx_rights_ledger_store.nx nx_rights_ledger_store_gate.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_dms_catalog.nxnx_dms_catalog_gate.nxnx_dms_catalog_store_gate.nxnx_dms_search.nxnx_dms_search_gate.nxnx_dms_search_store_gate.nxnx_offer_ledger_gate.nxnx_rights_ledger_gate.nxnx_rights_ledger_store.nxnx_rights_ledger_store_gate.nx

structs

50struct NxLicense
60struct NxRightsLedger

consts

25const NX_RL_NONE: nx_int = 0 // no matching row -> default-deny
26const NX_RL_GRANTED: nx_int = 1
27const NX_RL_EXPIRED: nx_int = 2
28const NX_RL_REVOKED: nx_int = 3
29const NX_RL_N_STATES: nx_int = 4
34const NX_USE_MERCH: nx_int = 0 // physical merchandise likeness
35const NX_USE_WEB_GALLERY: nx_int = 1 // display in owned gallery/search
36const NX_USE_AD_CAMPAIGN: nx_int = 2 // marketing / advertisement
37const NX_USE_AVATAR_NONEXPLICIT: nx_int = 3 // non-explicit synthetic avatar
38const NX_USE_N_SCOPES: nx_int = 4
41const NX_RL_OK: nx_int = 0
42const NX_RL_ERR_BAD_USE: nx_int = 1
43const NX_RL_ERR_FULL: nx_int = 2
44const NX_RL_ERR_NOT_FOUND: nx_int = 3
45const NX_RL_ERR_NOT_GRANTED: nx_int = 4
66const NX_RL_ROW_BYTES: nx_size = 56 // 7 fields * 8 bytes

functions

68func nx_use_is_valid(u: nx_int) -> nx_int
74func nx_rights_ledger_new(capacity: nx_size) -> *NxRightsLedger
called by 8: mainmainmainmainmainmain+2 calls 1: sys_mmap
83func _rl_at(l: *NxRightsLedger, idx: nx_size) -> *NxLicense
87func _rl_find(l: *NxRightsLedger, grant_id: nx_int) -> nx_int
called by 1: nx_rights_revoke calls 1: _rl_at
99func nx_rights_grant(l: *NxRightsLedger,
121func nx_rights_revoke(l: *NxRightsLedger, grant_id: nx_int, now_us: nx_size) -> nx_int
called by 5: mainmainmainmainmain calls 2: _rl_find_rl_at
135func nx_rights_state(l: *NxRightsLedger, talent_bk: nx_int, use_scope: nx_int, now_us: nx_size) -> nx_int
164func nx_rights_is_licensed(l: *NxRightsLedger, talent_bk: nx_int, use_scope: nx_int, now_us: nx_size) -> nx_int
169func nx_rights_count(l: *NxRightsLedger) -> nx_size
called by 2: mainmain
173func nx_rights_count_by_state(l: *NxRightsLedger, state: nx_int) -> nx_int
called by 1: main calls 1: _rl_at