code wiki / (root) / nx_lib_httpd.nx

nx_lib_httpd.nx

buildroot/runtime/nx_lib_httpd.nx

7403 B141 linesdepth 7pulls 14 transitivereach 0 importersview sourcekind tooltopic lib
docsdependenciesstructsconstsfunctions

about

nx_lib_httpd.nx -- sovereign HTTP DAEMON for the nishi-library read API. Serves the READ PATH over the wire straight from nx_lib_store, RETIRING the Python serve.py endpoints + its SQLite. No python, no 3rd-party HTTP stack, no shell: raw sovereign sockets (nx_syscalls, pulled via nx_lib_serve -- so we do NOT import nx_syscalls_x86_64.nx = no sys_* double-emit) + the pure router nx_lib_http. GET /api/works -> JSON array of work_hks GET /api/work/<hk> -> JSON work record (200) or 404 license_tier: ORIGINAL | genealogy_id: nishi_library_sovereign_httpd_2026_06_30

dependencies 1 imports · 0 importers

nx_lib_http.nx nx_lib_httpd.nx

imports: nx_lib_http.nx

imported by: nobody (leaf or entry point)

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

main lhd_sockaddr nx_lib_index_build nx_lib_store_index sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_scan_seglist ss_len sys_mmap ↻ ss_cat ss_readall ss_r32 nx_inv_new nx_lib_store_open ss_open ss_open2 ss_open3 sys_now_us sys_mmap ↻ ss_manifest_dyn ↻ ss3_admit

structs

none

consts

12const LHD_AF_INET: i64 = 2
13const LHD_SOCK_STREAM: i64 = 1
14const LHD_SOL_SOCKET: i64 = 1
15const LHD_SO_REUSEADDR: i64 = 2
16const LHD_PORT: i64 = 8095
17const LHD_BACKLOG: i64 = 128
18const LHD_BUDGET: i64 = 1000000 // JPL-rule-2 bounded accept loop
60const LHD_REQ_CAP: i64 = 131072
61const LHD_OUT_CAP: i64 = 1200000

functions

20func lhd_write_all(fd: i64, buf: *u8, n: i64) -> i64
called by 1: lhd_handle
63func lhd_reqbuf() -> *u8 { if LHD_REQ_BUF == 0 { LHD_REQ_BUF = sys_mmap(LHD_REQ_CAP) as i64 } return LHD_REQ_BUF as *u8 }
called by 1: lhd_handle
65func lhd_outbuf() -> *u8 { if LHD_OUT_BUF == 0 { LHD_OUT_BUF = sys_mmap(LHD_OUT_CAP) as i64 } return LHD_OUT_BUF as *u8 }
called by 1: lhd_handle
67func lhd_handle(cfd: i64) -> i64
110func lhd_sockaddr(addr: *u8, port: i64) -> i64
called by 1: main
120func main() -> i64