code wiki / wiki / nx_wiki_main.nx

nx_wiki_main.nx

buildroot/runtime/wiki/nx_wiki_main.nx

25753 B522 linesdepth 18pulls 110 transitivereach 0 importersview sourcekind tooltopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_main.nx -- wiki daemon entry point. Forks the nx_audit_server_routed::main 140-line accept-loop pattern. Reuses every existing HTTP / health / log primitive; zero new daemon primitives introduced (per duplicate-primitives audit). Per the small-sharp+composable standard: this file is the wiki's site-specific main() that wires the hub primitives + the wiki route dispatcher into a runnable daemon. COMPOSES: nx_http_server bind / listen / accept / read / send nx_kv_store session storage (caller-allocated) nx_hash_facade password hash compare nx_log_jsonl per-request structured log nx_syscalls (sys_read_file) read admin-hash file at startup nx_syscalls (sys_now_ms) wall-clock for session expiry hub/nx_admin_login_flow admin-login flow init wiki/nx_wiki_routes route dispatcher Status: V1 SEED. 2026-05-27. WINNER-TIER: BASELINE-C provisional (forks audit-server's shipped keepalive + per-conn-budget shape; throughput parity expected; paired bench pending wiki workload fixture) INCUMBENTS: nginx (single-process), Caddy, Apache HTTPD MPM, substrate's own nx_audit_server_routed NUMBERS: V1 ships the daemon; paired req/sec vs audit-server pending real load GAP: nginx multi-worker + master process management; V1 ships single-process with supervisor-restart on request-budget exhaustion (matches audit-server) PLAN: M-next: multi-worker fork pattern when wiki workload demands > 1 process's throughput EXEMPTION REASON: n/a; provisional pending measurement V1 HONEST SCOPE LIMITS (per NISHI_CODE_HYGIENE_STANDARD M6): - Bind: loopback-only (127.0.0.1:51850). Operator wires a reverse-proxy / nginx-front-end to expose at nishifamily.com/wiki. V2 supports listening on non-loopback addresses + TLS via future nx_tls_shim.

dependencies 19 imports · 0 importers

nx_syscalls.nx nx_http_server.nx nx_kv_store.nx nx_hash_facade.nx nx_log_jsonl.nx nx_http_header_find.nx nx_admin_login_flow.nx nx_search_handler_flow.nx nx_wiki_routes.nx nx_wiki_index_builder.nx nx_wiki_main.nx

diagram shows first 10 each side; +9 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_http_server.nxnx_kv_store.nxnx_hash_facade.nxnx_log_jsonl.nxnx_http_header_find.nxnx_admin_login_flow.nxnx_search_handler_flow.nxnx_wiki_routes.nxnx_wiki_index_builder.nxnx_wiki_page_save.nxnx_wiki_content_loader.nxnx_wiki_archive_router.nxnx_artifact_store.nxnx_pipeline_walker.nxnx_pipeline_recursive_walker.nxnx_pipeline_graph_builder.nxnx_dep_graph.nxnx_search_inverted.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_http_server_addr_any nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen nx_wiki_main_load_admin_ha sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ nx_kv_store_init nx_admin_login_config_init nx_search_flow_init sys_mmap ↻ nx_search_query_init sys_mmap ↻ nx_search_onsite_init sys_mmap ↻ nx_search_results_init nx_wiki_doc_store_init sys_mmap ↻ nx_wiki_index_builder_init nx_inv_new nx_wcl_load_discover_tree nx_wcl_discover_tree sys_openat_rd ↻ sys_close ↻ nx_wiki_index_builder_get_ nx_wiki_doc_store_count

structs

none

consts

71const NX_WIKI_MAIN_OK: i64 = 0
72const NX_WIKI_MAIN_BIND_FAILED: i64 = 1300
73const NX_WIKI_MAIN_NO_ADMIN_HASH: i64 = 1301
74const NX_WIKI_MAIN_KV_INIT_FAILED: i64 = 1302
75const NX_WIKI_MAIN_CONFIG_INIT_FAILED: i64 = 1303
76const NX_WIKI_MAIN_RANDOM_FAILED: i64 = 1304
77const NX_WIKI_MAIN_REQUEST_BUDGET_HIT: i64 = 1305
83const NX_WIKI_MAIN_BACKLOG: i64 = 64
84const NX_WIKI_MAIN_REALM: *u8 = "Nishi Wiki Admin" as *u8
85const NX_WIKI_MAIN_REALM_N: i64 = 16
86const NX_WIKI_MAIN_ADMIN_USERNAME: *u8 = "elderwesto" as *u8
87const NX_WIKI_MAIN_ADMIN_USERNAME_N: i64 = 10
88const NX_WIKI_MAIN_ADMIN_HASH_PATH: *u8 = "/tmp/nishi_wiki_admin_hash" as *u8
91const NX_WIKI_MAIN_SYS_GETRANDOM: i64 = 318 // x86_64
94const NX_WIKI_MAIN_KV_DATA_CAP: i64 = 1048576 // 1 MiB session data
95const NX_WIKI_MAIN_KV_INDEX_CAP: i64 = 65536 // 64 KiB index (~4000 sessions)
98const NX_WIKI_MAIN_RANDOM_BYTES: i64 = 16
101const NX_WIKI_MAIN_LOG_COMPONENT: *u8 = "nx_wiki_main" as *u8
102const NX_WIKI_MAIN_LOG_COMPONENT_N: i64 = 12

functions

115func nx_wiki_main_load_admin_hash(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
137func nx_wiki_main_fill_random(out_16: *u8) -> i64
152func nx_wiki_main_log_request(ts_ms: i64,
200func nxar_method_name(k: i64) -> *u8
206func nxar_method_name_len(k: i64) -> i64
225func main() -> i64