code wiki / _hdl_build / nx_sovgit_serve.nx

nx_sovgit_serve.nx

buildroot/runtime/_hdl_build/nx_sovgit_serve.nx

6010 B103 linesdepth 8pulls 15 transitivereach 0 importersview sourcekind servicetopic sovgit
docsdependenciesstructsconstsfunctions

about

nx_sovgit_serve.nx -- ★SOVGIT rung X1c: a minimal SOVEREIGN HTTP server (built on nx_http_server sockets, NO nginx/ framework) that serves our bare git repo over git's DUMB-HTTP protocol, so a STOCK `git clone http://HOST:18690/` round-trips over the NETWORK. On startup it assembles the repo (X0 objects + refs + HEAD + config + dumb info/refs + objects/info/packs), then accept-loops serving files statically. Reuses nx_sovgit_obj (X0/X1a). Runs forever (a test harness launches it in the background, clones, then kills it). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_sovgit_obj.nx nx_http_server.nx nx_sovgit_serve.nx

imports: nx_sovgit_obj.nxnx_http_server.nx

imported by: nobody (leaf or entry point)

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

main assemble_repo sys_mkdir sg_write_loose sg_oid_hex sys_mmap sg_oid_raw sys_mmap ↻ sg_frame sg_cpy sg_slen sg_dec sha256_digest sys_mmap ↻ sha256_init sha256_update sha256_final sys_munmap sg_hex sg_slen ↻ sys_mkdir ↻ sys_mmap ↻ sg_cpy ↻ sg_frame ↻ sg_zwrap dfe_compress sys_mmap ↻ dfe_fill_tables dfe_deflate sys_mmap ↻ dfe_bits dfe_hash dfe_matchlen dfe_sym dfe_rev sys_munmap ↻ sys_munmap ↻ sg_be32 adler32 sg_loose_path

structs

none

consts

8const K_MAGIC_18690: i64 = 18690
9const K_MAGIC_65536: i64 = 65536
10const K_MAGIC_262144: i64 = 262144

functions

12func lg(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: main
13func scopy(dst: *u8, at: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[at + i] = s[i]; i = i + 1 } return at + i }
called by 2: assemble_reposerve
14func udec(out: *u8, at: i64, v: i64) -> i64
called by 1: serve
20func wfile(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0 - 1 } sys_write(fd, buf, n); sys_close(fd); return 0 }
called by 2: wstrassemble_repo calls 1: sys_openat_wr
21func wstr(path: *u8, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return wfile(path, s, n) }
called by 1: assemble_repo calls 1: wfile
23func assemble_repo() -> i64
50func serve(cfd: i64, relpath: *u8, rlen: i64, resp: *u8) -> i64
78func main() -> i64