code wiki / _hdl_build / nx_connect_accounts.nx
nx_connect_accounts.nx
buildroot/runtime/_hdl_build/nx_connect_accounts.nx
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
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
| 10 | const ACC_MAGIC_4096: i64 = 4096 |
| 11 | const ACC_MAGIC_16777619: i64 = 16777619 |
| 12 | const ACC_MAGIC_1000003: i64 = 1000003 |
| 14 | const ACC_MAGIC0: i64 = 0x4e // 'N' |
| 15 | const ACC_MAGIC1: i64 = 0x58 // 'X' |
| 16 | const ACC_MAGIC2: i64 = 0x43 // 'C' |
| 17 | const ACC_MAGIC3: i64 = 0x41 // 'A' |
functions
| 20 | func acc_w64(p: *u8, off: i64, v: i64) -> i64 called by 1: acc_serialize |
| 26 | func acc_r64(p: *u8, off: i64) -> i64 called by 1: acc_deserialize |
| 33 | func acc_path(dir: *u8, account_id: i64, out: *u8) -> i64 |
| 54 | func acc_serialize(ctx: *i64, account_id: i64, buf: *u8) -> i64 |
| 118 | func acc_deserialize(ctx: *i64, buf: *u8, n: i64) -> i64 |
| 197 | func acc_save(ctx: *i64, account_id: i64, dir: *u8) -> i64 |
| 214 | func acc_load(ctx: *i64, account_id: i64, dir: *u8) -> i64 |
| 233 | func acc_id_from_handle(h: *u8) -> i64 called by 1: main |
| 245 | func acc_id_from_range(p: *u8, n: i64) -> i64 called by 1: main |
| 260 | func acc_cookie_get(req: *u8, reqlen: i64, out: *u8, cap: i64) -> i64 called by 1: main |
| 292 | func acc_session_mint(salt: i64, out: *u8) -> i64 |
| 309 | func acc_inject_cookie(resp: *u8, resp_len: i64, sess: *u8, sess_len: i64, out: *u8, cap: i64) -> i64 called by 1: main |