code wiki / _hdl_build / nx_siteedit_history.nx

nx_siteedit_history.nx

buildroot/runtime/_hdl_build/nx_siteedit_history.nx

5901 B145 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic siteedit
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_siteedit_history.nx nx_siteedit_daemon.nx nx_siteedit_history_gate.nx

imports: nx_syscalls.nx

imported by: nx_siteedit_daemon.nxnx_siteedit_history_gate.nx

structs

none

consts

8const SH_MAGIC_1024: i64 = 1024
9const SH_MAGIC_65536: i64 = 65536
11const SH_OPENAT: i64 = 257 // x86_64 openat(2)
12const SH_GETDENTS64: i64 = 217 // x86_64 getdents64(2)
13const SH_AT_FDCWD: i64 = 0 - 100
14const SH_O_DIRECTORY: i64 = 0x10000 // O_RDONLY(0) | O_DIRECTORY

functions

16func sh_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
17func 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
18func sh_catn(d: *u8, o: i64, v: i64) -> i64
30func sh_dir_of(cfgpath: *u8, dbuf: *u8) -> i64
called by 2: sh_listmain
43func sh_match(name: *u8, bname: *u8, bnl: i64) -> i64
called by 2: sh_listmain
63func 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
64func 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
67func sh_list(cfgpath: *u8, eps: *i64, cap: i64) -> i64
98func sh_sort_desc(eps: *i64, n: i64) -> i64
117func sh_qs_epoch(path: *u8, pn: i64) -> i64
139func sh_version_path(cfgpath: *u8, ep: i64, out: *u8) -> i64