code wiki / _hdl_build / nx_coedit_live_gate.nx

nx_coedit_live_gate.nx

buildroot/runtime/_hdl_build/nx_coedit_live_gate.nx

13562 B267 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_coedit_live_gate.nx -- LIVE real-time co-editing, END-TO-END over real loopback HTTP (the fork idiom of nx_relate_live_gate). This is the R2 proof that flips census OF-C1: the REAL blessed daemon (/tmp/nx_coedit.sov.elf serve) is one process; TWO independent client PROCESSES concurrently edit the SAME document through it and both CONVERGE to identical text -- which is exactly "real-time co-editing". server child = `nx_coedit serve <canon.log> <port>` (accept-loop, serves until killed) client A (rep 1) = POST its ops "AC-after-root" then POLL-pull until the log carries BOTH replicas client B (rep 2) = POST its ops "BD-after-root" then POLL-pull likewise convergence (pinned): root children order desc by (counter,replica) => rep2 first => "BDAC" on BOTH. Then the parent fork-execs `nx_coedit apply` on each client's pulled log and asserts BDAC == BDAC, and that the canonical server log UNIONED all 4 ops with NO duplicates (idempotent under repeated polling). expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_coedit_live_gate.nx

imports: nx_syscalls.nxnx_connect.nx

imported by: nobody (leaf or entry point)

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

main lg_p sys_write lg_slen sys_openat_rd sys_fork sys_mmap sys_execve sys_exit sys_wait4 sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real lg_catn sys_mmap ↻ lg_cat lg_mkempty sys_openat_wr sys_close sys_openat_wr ↻ sys_dup3 lg_push lg_sleep sys_mmap ↻ lg_post sys_mmap ↻ lg_cat ↻ lg_uint lg_catn ↻ lg_http sys_mmap ↻ lg_addr sys_socket sys_set_socket_timeout sys_mmap ↻ sys_setsockopt sys_munmap nx_connect_bounded nx_fcntl sys_connect

structs

none

consts

none

functions

16func lg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8) { n=n+1 } return n }
17func lg_p(s: *u8) -> i64 { sys_write(1, s, lg_slen(s)); return 0 }
called by 2: lg_rowmain calls 2: sys_writelg_slen
18func lg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { dst[off+i]=s[i]; i=i+1 } return off+i }
called by 2: lg_postmain
19func lg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: lg_uintmain calls 1: sys_mmap
25func lg_uint(dst: *u8, off: i64, v: i64) -> i64 { return lg_catn(dst, off, v) }
called by 1: lg_post calls 1: lg_catn
26func lg_write(path: *u8, buf: *u8, n: i64) -> i64
30func lg_mkempty(path: *u8) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 { return 0-1 } sys_close(fd); return 0 }
called by 1: main calls 2: sys_openat_wrsys_close
31func lg_readall(path: *u8, szout: *i64) -> *u8
37func lg_has(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: lg_filehas calls 1: lg_slen
43func lg_count(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: lg_slen
49func lg_filehas(path: *u8, needle: *u8) -> i64 { let sp: *i64=sys_mmap(16) as *i64; let b: *u8=lg_readall(path, sp); if sp[0]<0 { return 0 } return lg_has(b, sp[0], needle) }
called by 1: main calls 3: sys_mmaplg_readalllg_has
50func lg_fileis(path: *u8, exact: *u8) -> i64
called by 1: main calls 3: sys_mmaplg_readalllg_slen
55func lg_fileeq(p1: *u8, p2: *u8) -> i64
62func lg_addr(out: *u8, port: i64) -> i64
called by 1: lg_http
68func lg_sleep(spins: i64) -> i64 { var s: i64=0; while s<spins { s=s+1 } return 0 }
called by 1: lg_push
71func lg_http(port: i64, req: *u8, reqn: i64, out: *u8, cap: i64) -> i64
90func lg_post(port: i64, body: *u8, blen: i64, out: *u8, cap: i64) -> i64
102func lg_bodyoff(resp: *u8, rn: i64) -> i64
called by 2: lg_pushmain
112func lg_push(port: i64, ops: *u8, outlog: *u8) -> i64
125func lg_apply(inlog: *u8, outtxt: *u8) -> i64
143func lg_kill(pid: i64) -> i64 { return __syscall(129, pid, 9, 0, 0, 0, 0) } // rv64 kill=129 -- raw x86 62 is an RV64 KEY translated to lseek(8), the kill never happened (debt idx 2277)
145func lg_row(name: *u8, pass: i64) -> i64
called by 1: main calls 1: lg_p
149func main(argc: i64, argv: *i64) -> i64