code wiki / _hdl_build / nx_docportal_lib.nx
nx_docportal_lib.nx
buildroot/runtime/_hdl_build/nx_docportal_lib.nx
about
nx_docportal_lib.nx -- shared core for the PER-DOMAIN DOCUMENT PORTAL (operator 2026-06-28: "a document portal
to upload documents for their onsite search ... all our sites sharded off per domain ... public and private").
The s-class substrate is the SOVEREIGN seg_store (immutable append-only segments + content-addressed values +
never-delete) -- NOT a new TSV database (operator: get off TSV). ONE call ingests a document into the domain's
PUBLIC store (also emitted to the domain's derived BM25 search source so it is findable on <domain>/search) or
PRIVATE store (the client vault, NEVER emitted to the public search source).
THE PUBLIC/PRIVATE SPLIT IS BY CONSTRUCTION: public and private are DIFFERENT store prefixes => DIFFERENT
physical segment files => a public search query cannot read the private shard (it never opens those files).
THE PER-DOMAIN SHARD is the domain: prefix carries <domain>, so a query scoped to domain A cannot read domain
B's segments the same way. This is the records-management "balance of confidentiality, data privacy, and public
access" (ldm_records_mgmt) enforced mechanically, not by an ACL check that can be misconfigured.
CID = deterministic content id (FNV-1a, folded positive): same bytes -> same CID (exceed dimension #8); used as
the segid so distinct content never overwrites a prior doc's segment (never-delete) and identical re-ingest is
idempotent. The cryptographic seal (sha256 via nx_doc_seal) is a later rung. Composes nx_seg_store + nx_fnv.
license_tier: ORIGINAL
dependencies 3 imports · 16 importers
diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.
imports: nx_seg_store.nxnx_fnv.nxnx_syscalls.nx
imported by: nx_doc_at_rest.nxnx_doc_at_rest_gate.nxnx_doc_authz.nxnx_doc_authz_gate.nxnx_docportal_admin_lib.nxnx_docportal_aiblog_lib.nxnx_docportal_at_rest_gate.nxnx_docportal_authz_route_gate.nxnx_docportal_ingest.nxnx_docportal_ingest_gate.nxnx_docportal_search_gate.nxnx_dp_leak_gate.nxnx_dp_reclassify.nxnx_dp_reclassify_gate.nxnx_nist_ingest.nxnx_nvd_ingest.nx
structs
| none |
consts
| 22 | const DP_VIS_PUBLIC: i64 = 0 |
| 23 | const DP_VIS_PRIVATE: i64 = 1 |
| 26 | const DP_USE_PUB_SEARCH: i64 = 1 // index this doc for the public onsite search |
| 27 | const DP_USE_AI_BLOG: i64 = 2 // an AI writer MAY publish blog posts derived from this content |
| 28 | const DP_USE_AI_SUMMARY: i64 = 4 // AI may summarize/derive internally (non-publishing) |
| 29 | const DP_USE_SHARE_EXT: i64 = 8 // may be shared outside the firm |
functions
| 31 | func dp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func dp_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 33 | func dp_catn(out: *u8, o: i64, v: i64) -> i64 |
| 44 | func dp_cid(text: *u8, n: i64) -> i64 |
| 51 | func dp_prefix(domain: *u8, vis: i64, out: *u8) -> i64 |
| 60 | func dp_key(cid: i64, out: *u8) -> i64 |
| 79 | func dp_ingest(domain: *u8, vis: i64, text: *u8, n: i64, cidout: *i64) -> i64 |
| 86 | func dp_read(domain: *u8, vis: i64, cid: i64, ptrout: *i64, lenout: *i64) -> i64 |
| 107 | func dp_default_policy(vis: i64) -> i64 |
| 111 | func dp_polkey(cid: i64, out: *u8) -> i64 { var o: i64 = dp_cat(out, 0, "pol:" as *u8); o = dp_catn(out, o, cid); out[o] = 0 as u8; return o } |
| 116 | func dp_blogsrc(domain: *u8, out: *u8) -> i64 |
| 119 | func dp_append_blogsrc(domain: *u8, cid: i64, text: *u8, n: i64) -> i64 |
| 130 | func dp_ingest_policy(domain: *u8, vis: i64, flags: i64, text: *u8, n: i64, cidout: *i64) -> i64 |
| 149 | func dp_get_policy(domain: *u8, vis: i64, cid: i64) -> i64 |
| 162 | func dp_may(domain: *u8, vis: i64, cid: i64, use_flag: i64) -> i64 |
| 171 | func dp_set_policy(domain: *u8, vis: i64, cid: i64, flags: i64) -> i64 |