nx_wiki_routes.nx
buildroot/runtime/wiki/nx_wiki_routes.nx
about
nx_wiki_routes.nx -- wiki HTTP route dispatcher (main daemon entry).
Forks the nx_audit_server_routed.nx pattern (687-line template).
Reuses every existing HTTP / health / metrics / per-conn-budget
primitive per the duplicate-primitives audit; zero new HTTP /
daemon primitives introduced.
COMPOSES (per NISHI_SMALL_SHARP_COMPOSABLE_STANDARD ยง4.1 M7):
nx_http_server bind / listen / accept / read / send
nx_http_health /health + /ready endpoints
nx_http_metrics /metrics (Prometheus text)
nx_log_jsonl per-request structured log emit
wiki/nx_wiki_admin_wiring /wiki/admin/* handler
wiki/nx_wiki_doc_render /wiki/<doc-name> handler
hub/nx_admin_login_flow (transitively via admin_wiring)
COMPOSED BY:
wiki/nx_wiki_main.nx daemon main() entry (future commit)
Status: V1 SEED. 2026-05-27.
WINNER-TIER: BASELINE-C provisional (forks the audit-server's
shipped patterns; throughput + latency parity with
the audit server expected since it's the same
keepalive + per-conn-budget shape; paired bench
pending real wiki workload fixture)
INCUMBENTS: nginx (route dispatch), Caddy, Apache HTTPD,
substrate's own nx_audit_server_routed (closest
reference; same family)
NUMBERS: V1 ships the route table + dispatcher; paired
throughput bench vs nginx + audit-server pending
wiki-doc-set fixture
GAP: nginx has rewrite rules + load balancing + reverse
proxy + cache; V1 ships JUST wiki-specific routes
(small-sharp per the standard; nginx-class features
add as needed when wiki workload demands)
PLAN: M-next: paired throughput vs audit-server (same
hardware); add nx_http_metrics integration for
wiki-specific counters
EXEMPTION REASON: n/a; provisional pending measurement
dependencies 22 imports · 4 importers
diagram shows first 10 each side; +12 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_http_server.nxnx_http_health_emit.nxnx_http_metrics.nxnx_log_jsonl.nxnx_http_header_find.nxnx_wiki_admin_wiring.nxnx_wiki_doc_render.nxnx_wiki_search_wiring.nxnx_wiki_index_builder.nxnx_wiki_doc_handler.nxnx_wiki_edit_handler.nxnx_wiki_status.nxnx_wiki_article.nxnx_wiki_queue.nxnx_wiki_dashboard.nxnx_wiki_archive_router.nxnx_pipeline_route.nxnx_artifact_store.nxnx_wiki_graph.nxnx_search_handler_flow.nxnx_search_inverted.nx
imported by: _wiki_integrate_gate.nxnx_wiki_https_daemon.nxnx_wiki_https_daemon_mv.nxnx_wiki_main.nx
structs
| none |
consts
| 92 | const NX_WIKI_ROUTE_OK: i64 = 0 |
| 93 | const NX_WIKI_ROUTE_BAD_INPUT: i64 = 1200 |
| 94 | const NX_WIKI_ROUTE_BUF_OVERFLOW: i64 = 1201 |
| 95 | const NX_WIKI_ROUTE_HANDLER_FAILED: i64 = 1202 |
| 96 | const NX_WIKI_ROUTE_NOT_IMPLEMENTED: i64 = 1203 |
| 97 | const NX_WIKI_ROUTE_UNKNOWN: i64 = 1204 |
| 100 | const NX_WIKI_ROUTE_PORT: i64 = 51850 |
| 101 | const NX_WIKI_ROUTE_REQ_CAP: i64 = 16384 |
| 102 | const NX_WIKI_ROUTE_RESP_CAP: i64 = 1048576 // 1 MiB (docs can be large) |
| 103 | const NX_WIKI_ROUTE_REQUEST_BUDGET: i64 = 1000000 |
| 104 | const NX_WIKI_ROUTE_PER_CONN_BUDGET: i64 = 100 // keepalive cap per audit-server pattern |
| 107 | const NX_WIKI_ROUTE_METHOD_GET: i64 = 1 |
| 108 | const NX_WIKI_ROUTE_METHOD_POST: i64 = 2 |
| 109 | const NX_WIKI_ROUTE_METHOD_OPTIONS: i64 = 3 |
| 239 | const NX_WIKI_GRAPH_PAGE_CAP: i64 = 786432 // 768 KB SVG+chrome scratch |
functions
| 116 | func nx_wiki_route_starts_with(path: *u8, path_n: i64, called by 1: nx_wiki_route_dispatch |
| 132 | func nx_wiki_route_ends_with(path: *u8, path_n: i64, called by 1: nx_wiki_route_dispatch |
| 145 | func nx_wiki_route_eq(path: *u8, path_n: i64, called by 1: nx_wiki_route_dispatch |
| 162 | func nx_wiki_route_append(out: *u8, off: *i64, cap: i64, |
| 175 | func nx_wiki_route_append_z(out: *u8, off: *i64, cap: i64, src: *u8) -> i64 |
| 191 | func nx_wiki_route_serve_index(out: *u8, out_cap: i64, out_n: *i64) -> i64 |
| 241 | func nx_wiki_route_serve_graph(doc_store: *NxWikiDocStore, |
| 330 | func nx_wiki_route_serve_501(out: *u8, out_cap: i64, out_n: *i64, |
| 379 | func nx_wiki_route_serve_404(out: *u8, out_cap: i64, out_n: *i64) -> i64 |
| 393 | func nx_wiki_route_serve_405(out: *u8, out_cap: i64, out_n: *i64) -> i64 |
| 419 | func nx_wiki_route_dispatch(http_req_buf: *u8, http_headers_end: i64, |