code wiki / _hdl_build / nx_sovgit_push.nx

nx_sovgit_push.nx

buildroot/runtime/_hdl_build/nx_sovgit_push.nx

50886 B1139 linesdepth 20pulls 143 transitivereach 0 importersview sourcekind tooltopic sovgit
docsdependenciesstructsconstsfunctions

about

nx_sovgit_push.nx -- ★SOVGIT F222: the SOVEREIGN GIT PUSHER. Snapshots a working tree and pushes it to a sovgit host speaking the git receive-pack CLIENT wire, with ZERO /usr/bin/git anywhere in the path. This is the no-git-law end-state for the replication leg: walk -> X0 sha256 objects -> X1b packfile -> pkt-line ref-update + pack over HTTP -> report-status. The ark's crash-durability beat becomes sovereign. WHY A SNAPSHOT (not a git-history mirror): stock git CANNOT push a sha1 repo to a sha256 remote (no interop), so the sovereign leg re-frames the working tree as sha256 objects. Each push chains a commit onto the remote ref (parent = the advertised old sha) so history is preserved additively (rule 13) -- exactly the ark's job. SCALE ENVELOPE (declared in output, guarded in code, fail LOUD -- never a silent partial snapshot): entries per directory <= 20000 name bytes per directory <= 2 MiB tree depth <= 32 single file <= 64 MiB pack <= 128 MiB path <= 4096 skipped by design: .git, symlinks + special files, and SECRET MATERIAL (deny-by-construction: secret/passw/token/credential/.pem/.cap/.key/_key(s)/privkey/id_rsa/id_ed25519/_seed.bin/opaque) -- every exclusion is COUNTED and NAMED on stderr, never silently dropped ⚠the SERVER's request envelope also binds (nx_sovgit_git req buffer); a push above it is refused there. Transport rung 1 = loopback TCP (127.0.0.1:<port>) -- the daemon is wall-only by design; the TLS/edge transport for off-box pushes is the sibling rung (compose mcl_req-class primitives). license_tier: ORIGINAL

dependencies 11 imports · 0 importers

nx_sovgit_obj.nx nx_connect.nx nx_acme_http.nx nx_https_url_for_fetch.nx nx_https_url_connect.nx nx_tls13_client_session_run.nx nx_tls13_client_session.nx nx_tls13.nx nx_tls13_record.nx nx_tls13_read_record_from_fd.nx nx_sovgit_push.nx

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

imports: nx_sovgit_obj.nxnx_connect.nxnx_acme_http.nxnx_https_url_for_fetch.nxnx_https_url_connect.nxnx_tls13_client_session_run.nxnx_tls13_client_session.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_read_record_from_fd.nxnx_csprng.nx

imported by: nobody (leaf or entry point)

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

main sgp_w sgp_cat sgp_atoi nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

33const SGP_MAGIC_131072: i64 = 131072
34const SGP_MAGIC_61440: i64 = 61440
35const SGP_MAGIC_16384: i64 = 16384
36const SGP_MAGIC_32768: i64 = 32768
37const SGP_MAGIC_16645: i64 = 16645
38const SGP_MAGIC_2048: i64 = 2048
39const SGP_MAGIC_18691: i64 = 18691
40const SGP_MAGIC_4194304: i64 = 4194304
41const SGP_MAGIC_8192: i64 = 8192
42const SGP_MAGIC_1024: i64 = 1024
43const SGP_MAGIC_65536: i64 = 65536
44const SGP_MAGIC_4096: i64 = 4096
51const SGP_EDGE_SAFE: i64 = 1400000
52const SGP_MAX_OBJ: i64 = 200000
53const SGP_HS_SIZE: i64 = 524288
54const SGP_MAX_ENT: i64 = 20000
55const SGP_NAMEARENA: i64 = 2097152
56const SGP_MAX_DEPTH: i64 = 32
57const SGP_MAX_FILE: i64 = 67108864
58const SGP_PACK_CAP: i64 = 134217728
59const SGP_PATHBUF: i64 = 4096
60const SGP_RESP: i64 = 65536

functions

63func sgp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
64func sgp_we(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 2: sgp_walksgp_xfer
65func sgp_wn(v: i64) -> i64
calls 1: sys_munmap
78func sgp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
79func sgp_cat(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 }
80func sgp_dec(out: *u8, at: i64, v: i64) -> i64
called by 1: sgp_build_req calls 1: sys_munmap
92func sgp_atoi(s: *u8) -> i64
called by 1: main
102func sgp_streq(a: *u8, b: *u8) -> i64
called by 1: sgp_walk
120func sgp_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: sgp_needle_ci
121func sgp_needle_ci(name: *u8, needle: *u8) -> i64
140func sgp_load_ignore(srcdir: *u8, ibuf: *u8, icap: i64, pst: *i64) -> i64
189func sgp_is_ignored(name: *u8, pst: *i64) -> i64
called by 1: sgp_walk calls 2: sgp_needle_cisgp_slen
208func sgp_is_doc_ext(name: *u8) -> i64
called by 1: sgp_is_secret calls 2: sgp_slensgp_needle_ci
216func sgp_is_secret(name: *u8) -> i64
235func sgp_isdots(nm: *u8) -> i64
called by 1: sgp_walk
243func sgp_join(buf: *u8, base: i64, name: *u8) -> i64
called by 1: sgp_walk
252func sgp_u32(b: *u8, at: i64) -> i64
called by 1: sgp_walk
258func sgp_read_file(path: *u8, out_len: *i64) -> *u8
281func sgp_be32(out: *u8, at: i64, v: i64) -> i64
288func sgp_objhdr(out: *u8, at: i64, typ: i64, size: i64) -> i64
called by 1: sgp_pack_add
297func sgp_pack_begin(pack: *u8, pst: *i64) -> i64
calls 1: sgp_be32
307func sgp_pack_add(pack: *u8, pst: *i64, typ: i64, content: *u8, clen: i64) -> i64
called by 1: sgp_emit calls 2: sgp_objhdrsg_zwrap
324func sgp_hs_hash(sha: *u8, mask: i64) -> i64
330func sgp_hs_build(shas: *u8, n: i64, table: *i64, tsize: i64) -> i64
calls 1: sgp_hs_hash
346func sgp_hs_has(shas: *u8, table: *i64, tsize: i64, q: *u8) -> i64
called by 1: sgp_emit calls 1: sgp_hs_hash
364func sgp_havepath(dst: *u8, repo: *u8, ref: *u8) -> i64
calls 1: sgp_cat
377func sgp_emit(pack: *u8, pst: *i64, typ: i64, content: *u8, clen: i64, raw32: *u8, allshas: *u8, hshas: *u8, htab: *i64) -> i64
called by 1: sgp_walk calls 2: sgp_hs_hassgp_pack_add
386func sgp_pack_end(pack: *u8, pst: *i64) -> i64
397func sgp_chr(s: *u8, n: i64, isdir: i64, i: i64) -> i64
called by 1: sgp_keycmp
402func sgp_keycmp(a: *u8, an: i64, ad: i64, b: *u8, bn: i64, bd: i64) -> i64
called by 1: sgp_entcmp calls 1: sgp_chr
417func sgp_entcmp(arena: *u8, noff: *i64, nlen: *i64, isdir: *i64, x: i64, y: i64) -> i64
called by 1: sgp_msort calls 1: sgp_keycmp
423func sgp_msort(arena: *u8, noff: *i64, nlen: *i64, isdir: *i64, idx: *i64, aux: *i64, n: i64) -> i64
called by 1: sgp_walk calls 1: sgp_entcmp
459func sgp_walk(path: *u8, plen: i64, pack: *u8, pst: *i64, depth: i64, out_sha32: *u8, out_ecount: *i64, stats: *i64, allshas: *u8, hshas: *u8, htab: *i64) -> i64
597func sgp_connect(port: i64) -> i64
612func sgp_write_all(fd: i64, buf: *u8, n: i64) -> i64
621func sgp_drain(fd: i64, buf: *u8, cap: i64) -> i64
called by 1: sgp_http calls 1: sys_read
633func sgp_build_req(out: *u8, method: *u8, path: *u8, host: *u8, capstr: *u8, ct: *u8, body: *u8, blen: i64) -> i64
calls 2: sgp_catsgp_dec
657func sgp_http(port: i64, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64
670func sgp_tls_send_drain(s: *Tls13ClientSession, fd: i64, req: *u8, req_len: i64, out: *u8, out_cap: i64) -> i64
731func sgp_https(store: *TrustStore, url: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64
761func sgp_xfer_once(mode: i64, port: i64, store: *TrustStore, urlbase: *u8, path: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64
776func sgp_xfer(mode: i64, port: i64, store: *TrustStore, urlbase: *u8, path: *u8, req: *u8, reqlen: i64, out: *u8, outcap: i64) -> i64
805func sgp_dump(buf: *u8, n: i64, want: i64) -> i64
812func sgp_find(hay: *u8, hn: i64, needle: *u8) -> i64
calls 1: sgp_slen
825func sgp_find_ref(buf: *u8, n: i64, refpath: *u8, out64: *u8) -> i64
857func main(argc: i64, argv: *i64) -> i64