code wiki / _hdl_build / nx_coedit_live_gate.nx
nx_coedit_live_gate.nx
buildroot/runtime/_hdl_build/nx_coedit_live_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 16 | func lg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8) { n=n+1 } return n } |
| 17 | func lg_p(s: *u8) -> i64 { sys_write(1, s, lg_slen(s)); return 0 } |
| 18 | func 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 } |
| 19 | func lg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 25 | func lg_uint(dst: *u8, off: i64, v: i64) -> i64 { return lg_catn(dst, off, v) } |
| 26 | func lg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 30 | func lg_mkempty(path: *u8) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 { return 0-1 } sys_close(fd); return 0 } |
| 31 | func lg_readall(path: *u8, szout: *i64) -> *u8 |
| 37 | func lg_has(buf: *u8, n: i64, needle: *u8) -> i64 |
| 43 | func lg_count(buf: *u8, n: i64, needle: *u8) -> i64 |
| 49 | func 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) } |
| 50 | func lg_fileis(path: *u8, exact: *u8) -> i64 |
| 55 | func lg_fileeq(p1: *u8, p2: *u8) -> i64 |
| 62 | func lg_addr(out: *u8, port: i64) -> i64 called by 1: lg_http |
| 68 | func lg_sleep(spins: i64) -> i64 { var s: i64=0; while s<spins { s=s+1 } return 0 } called by 1: lg_push |
| 71 | func lg_http(port: i64, req: *u8, reqn: i64, out: *u8, cap: i64) -> i64 called by 2: lg_postmain calls 8: sys_mmaplg_addrsys_socketsys_set_socket_timeoutnx_connect_boundedsys_close+2 |
| 90 | func lg_post(port: i64, body: *u8, blen: i64, out: *u8, cap: i64) -> i64 |
| 102 | func lg_bodyoff(resp: *u8, rn: i64) -> i64 |
| 112 | func lg_push(port: i64, ops: *u8, outlog: *u8) -> i64 |
| 125 | func lg_apply(inlog: *u8, outtxt: *u8) -> i64 |
| 143 | func 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) |
| 145 | func lg_row(name: *u8, pass: i64) -> i64 |
| 149 | func main(argc: i64, argv: *i64) -> i64 |