nx_rights_ledger.nx
buildroot/runtime/nx_rights_ledger.nx
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
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
| 50 | struct NxLicense |
| 60 | struct NxRightsLedger |
consts
| 25 | const NX_RL_NONE: nx_int = 0 // no matching row -> default-deny |
| 26 | const NX_RL_GRANTED: nx_int = 1 |
| 27 | const NX_RL_EXPIRED: nx_int = 2 |
| 28 | const NX_RL_REVOKED: nx_int = 3 |
| 29 | const NX_RL_N_STATES: nx_int = 4 |
| 34 | const NX_USE_MERCH: nx_int = 0 // physical merchandise likeness |
| 35 | const NX_USE_WEB_GALLERY: nx_int = 1 // display in owned gallery/search |
| 36 | const NX_USE_AD_CAMPAIGN: nx_int = 2 // marketing / advertisement |
| 37 | const NX_USE_AVATAR_NONEXPLICIT: nx_int = 3 // non-explicit synthetic avatar |
| 38 | const NX_USE_N_SCOPES: nx_int = 4 |
| 41 | const NX_RL_OK: nx_int = 0 |
| 42 | const NX_RL_ERR_BAD_USE: nx_int = 1 |
| 43 | const NX_RL_ERR_FULL: nx_int = 2 |
| 44 | const NX_RL_ERR_NOT_FOUND: nx_int = 3 |
| 45 | const NX_RL_ERR_NOT_GRANTED: nx_int = 4 |
| 66 | const NX_RL_ROW_BYTES: nx_size = 56 // 7 fields * 8 bytes |
functions
| 68 | func nx_use_is_valid(u: nx_int) -> nx_int |
| 74 | func nx_rights_ledger_new(capacity: nx_size) -> *NxRightsLedger |
| 83 | func _rl_at(l: *NxRightsLedger, idx: nx_size) -> *NxLicense |
| 87 | func _rl_find(l: *NxRightsLedger, grant_id: nx_int) -> nx_int |
| 99 | func nx_rights_grant(l: *NxRightsLedger, |
| 121 | func nx_rights_revoke(l: *NxRightsLedger, grant_id: nx_int, now_us: nx_size) -> nx_int |
| 135 | func nx_rights_state(l: *NxRightsLedger, talent_bk: nx_int, use_scope: nx_int, now_us: nx_size) -> nx_int |
| 164 | func nx_rights_is_licensed(l: *NxRightsLedger, talent_bk: nx_int, use_scope: nx_int, now_us: nx_size) -> nx_int |
| 169 | func nx_rights_count(l: *NxRightsLedger) -> nx_size |
| 173 | func nx_rights_count_by_state(l: *NxRightsLedger, state: nx_int) -> nx_int |