code wiki / (root) / nx_email_mailbox.nx

nx_email_mailbox.nx

buildroot/runtime/nx_email_mailbox.nx

6559 B152 linesdepth 3pulls 3 transitivereach 10 importersview sourcekind librarytopic email
docsdependenciesstructsconstsfunctions

about

nx_email_mailbox.nx -- EMAIL RUNG R3: additive-only mailbox store. module: nishi-core.email.mailbox depends: nishi-core.store.seg_store capability: CORE_EMAIL Where delivered mail LIVES. Composes the sovereign segment store (nx_seg_store) rather than inventing persistence -- a message is one keyed record (kind=1 put, key=Message-ID, value=raw RFC 5322 bytes); deletion is a kind=2 TOMBSTONE appended in a new segment, never an erase. This makes the mailbox obey Cardinal 13 (additive-only, soft-delete via is_current, history is sacred) for free: a deleted message vanishes from the current view (ss_get returns "tombstoned") but every version is still walkable via ss_scan -- exactly what an audit/undelete/IMAP-history needs. segid is supplied by the caller (a monotonic counter in production); each deliver/delete commits one new immutable segment, so concurrent readers never see a torn write (ss_commit renames into place). license_tier: INDEPENDENT_REDERIVE genealogy_id: nishi_sovereign_segment_store + maildir_semantics lineage_id: nishi_email_mailbox_r3 nx_safety_envelope: intended_use: "Deliver/fetch/soft-delete mail over the sovereign segment store. Additive mailbox." sil_target: SIL2 (lost/leaked mail) evidence: [composes_nx_seg_store, byte-exact_fetch, tombstone_softdelete, history_retained, per-key_isolation] hazard_register: [bug-tape-mail-loss, bug-tape-delete-erases-history] residual_risk: "Monotonic segid allocation + folder hierarchy (INBOX/Sent/...) are upstream concerns; this is the single-mailbox record substrate." verdict: NOT_YET_EVALUATED

dependencies 2 imports · 4 importers

nx_seg_store.nx nx_syscalls.nx nx_email_mailbox.nx nx_email_mailbox_gate.nx nx_email_mta_gate.nx nx_email_mta_io.nx nx_email_webmail.nx

imports: nx_seg_store.nxnx_syscalls.nx

imported by: nx_email_mailbox_gate.nxnx_email_mta_gate.nxnx_email_mta_io.nxnx_email_webmail.nx

structs

none

consts

41const NX_MBOX_CAP: i64 = 260
42const NX_MBOX_KIND_PUT: i64 = 1
43const NX_MBOX_KIND_TOMB: i64 = 2

functions

47func nx_mbox_deliver(prefix: *u8, msgid: *u8, raw: *u8, rlen: i64, segid: i64) -> i64
called by 2: mainmain calls 3: ss_beginss_addss_commit
54func nx_mbox_delete(prefix: *u8, msgid: *u8, segid: i64) -> i64
63func nx_mbox_fetch(prefix: *u8, msgid: *u8, ptrout: *i64, lenout: *i64) -> i64
called by 2: mainmain calls 1: ss_get_cap
68func nx_mbox_exists(prefix: *u8, msgid: *u8) -> i64
called by 1: main calls 2: sys_mmapss_get_cap
78func nx_mbox_history_count(prefix: *u8, msgid: *u8) -> i64
called by 1: main calls 2: sys_mmapss_scan
90func mbox_itoa(v: i64, out: *u8) -> i64
called by 2: mbox_keynx_mbox_append calls 1: sys_mmap
98func mbox_atoi(s: *u8, n: i64) -> i64
called by 1: nx_mbox_count
104func mbox_key(mailbox: *u8, seq: i64, out: *u8) -> i64
115func nx_mbox_count(prefix: *u8, mailbox: *u8) -> i64
123func nx_mbox_append(prefix: *u8, mailbox: *u8, raw: *u8, rlen: i64, segid: i64) -> i64
137func nx_mbox_get_n(prefix: *u8, mailbox: *u8, idx: i64, ptrout: *i64, lenout: *i64) -> i64
145func nx_mbox_delete_n(prefix: *u8, mailbox: *u8, idx: i64, segid: i64) -> i64