code wiki / _hdl_build / nx_connect_accounts.nx

nx_connect_accounts.nx

buildroot/runtime/_hdl_build/nx_connect_accounts.nx

14506 B336 linesdepth 4pulls 13 transitivereach 4 importersview sourcekind librarytopic connect
docsdependenciesstructsconstsfunctions

about

nx_connect_accounts.nx -- CONNECT accounts + PERSISTENCE (the "demo state resets on restart" gap, the gateway from demo to product). PURE CORE (no main). Persists the SAME cs_world the daemon serves (composes nx_connect_serve) to a per-account binary snapshot file dir/<account_id>.cst, so each account's chat + events + poll SURVIVE a daemon restart AND are ISOLATED by construction (the account_id is in the path -- account A can never read account B's file). Snapshot-on-mutation + load-on-session; additive (rule 13): a save is a full snapshot, the prior file is replaced tmp+rename so a crash never leaves a torn state. account_id = a stable i64 (a session-derived pseudonym, or a handle hash for the demo). license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_connect_serve.nx nx_connect_accounts.nx nx_connect_accounts_gate.nx nx_connect_appd.nx nx_connect_contacts_gate.nx nx_connect_session_gate.nx

imports: nx_connect_serve.nx

imported by: nx_connect_accounts_gate.nxnx_connect_appd.nxnx_connect_contacts_gate.nxnx_connect_session_gate.nx

structs

none

consts

10const ACC_MAGIC_4096: i64 = 4096
11const ACC_MAGIC_16777619: i64 = 16777619
12const ACC_MAGIC_1000003: i64 = 1000003
14const ACC_MAGIC0: i64 = 0x4e // 'N'
15const ACC_MAGIC1: i64 = 0x58 // 'X'
16const ACC_MAGIC2: i64 = 0x43 // 'C'
17const ACC_MAGIC3: i64 = 0x41 // 'A'

functions

20func acc_w64(p: *u8, off: i64, v: i64) -> i64
called by 1: acc_serialize
26func acc_r64(p: *u8, off: i64) -> i64
called by 1: acc_deserialize
33func acc_path(dir: *u8, account_id: i64, out: *u8) -> i64
54func acc_serialize(ctx: *i64, account_id: i64, buf: *u8) -> i64
called by 2: acc_savemain calls 1: acc_w64
118func acc_deserialize(ctx: *i64, buf: *u8, n: i64) -> i64
called by 3: acc_loadmainmain calls 1: acc_r64
197func acc_save(ctx: *i64, account_id: i64, dir: *u8) -> i64
214func acc_load(ctx: *i64, account_id: i64, dir: *u8) -> i64
233func acc_id_from_handle(h: *u8) -> i64
called by 1: main
245func acc_id_from_range(p: *u8, n: i64) -> i64
called by 1: main
292func acc_session_mint(salt: i64, out: *u8) -> i64
called by 1: main calls 1: sys_now_realtime_ms