code wiki / _hdl_build / nx_siteedit_history.nx
nx_siteedit_history.nx
buildroot/runtime/_hdl_build/nx_siteedit_history.nx
about
nx_siteedit_history.nx -- N-deep revision history for the site editor. PURE enumeration lib (nx_syscalls only,
no HTML): sed_version_keep writes a `<cfgpath>.v<epoch>` snapshot on EVERY save, so history already accumulates
on disk -- this reads it back. sh_list getdents64's the config's directory, matches `<basename>.v<digits>`,
collects epochs; sh_sort_desc orders newest-first; sh_version_path rebuilds a snapshot path for restore/view.
The daemon renders the browse+restore page from these + does the (additive) restore. Gated by
nx_siteedit_history_gate (fixture dir, no live FS). license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_siteedit_daemon.nxnx_siteedit_history_gate.nx
structs
| none |
consts
| 8 | const SH_MAGIC_1024: i64 = 1024 |
| 9 | const SH_MAGIC_65536: i64 = 65536 |
| 11 | const SH_OPENAT: i64 = 257 // x86_64 openat(2) |
| 12 | const SH_GETDENTS64: i64 = 217 // x86_64 getdents64(2) |
| 13 | const SH_AT_FDCWD: i64 = 0 - 100 |
| 14 | const SH_O_DIRECTORY: i64 = 0x10000 // O_RDONLY(0) | O_DIRECTORY |
functions
| 16 | func sh_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 17 | func sh_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } called by 1: sh_version_path |
| 18 | func sh_catn(d: *u8, o: i64, v: i64) -> i64 |
| 30 | func sh_dir_of(cfgpath: *u8, dbuf: *u8) -> i64 |
| 43 | func sh_match(name: *u8, bname: *u8, bnl: i64) -> i64 |
| 63 | func sh_open_dir(path: *u8) -> i64 { return __syscall(SH_OPENAT, SH_AT_FDCWD, path as i64, SH_O_DIRECTORY, 0, 0, 0) } called by 1: sh_list |
| 64 | func sh_getdents(fd: i64, buf: *u8, cap: i64) -> i64 { return __syscall(SH_GETDENTS64, fd, buf as i64, cap, 0, 0, 0) } called by 1: sh_list |
| 67 | func sh_list(cfgpath: *u8, eps: *i64, cap: i64) -> i64 |
| 98 | func sh_sort_desc(eps: *i64, n: i64) -> i64 |
| 117 | func sh_qs_epoch(path: *u8, pn: i64) -> i64 |
| 139 | func sh_version_path(cfgpath: *u8, ep: i64, out: *u8) -> i64 |