interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / nodes / stat.om
| 1 | note nodes/stat.om: /status and /status.json, this Radicle node's health, from one snapshot file. |
| 2 | note The writer (nodes/snap.om, run by aien-nodes.service when the node database changes) owns the |
| 3 | note file; this page only reads it and never runs a program. Format, one item per line: |
| 4 | note 2 / unix time written / our node id / connected peers / then "RID scope copies behind reach wait" |
| 5 | note A data line is shown only when it has the exact shape nsshape checks (a RID of 1..64 letters or |
| 6 | note digits, five 1..19-digit numbers, single spaces) and its RID is on the allow-list, so a withdrawn |
| 7 | note RID or a poisoned line (markup, quotes, an over-long field) is never shown. |
| 8 | text nssnap "/home/drakestapleton/.local/state/aien-factory/nodes.txt" |
| 9 | text tfst "/status" |
| 10 | text tfstj "/status.json" |
| 11 | text nstit "Node health" |
| 12 | text nsh1 "<h1>Node health</h1>\n<p class=\"muted\">The node this forge ran was shut down on 2026-11-14. What follows is its last snapshot (which other nodes held our signed copy of each repository, and when they took it), kept as history.</p>\n<p>Checked " |
| 13 | text nsh2 " UTC, " |
| 14 | text nsh3 " seconds before this page. Connected peers: <b>" |
| 15 | text nsh4 "</b>.</p>\n<p class=\"muted\">Copies: other nodes holding our signed copy of the repository. Behind: how many of those do not have our latest version yet. Reach: seconds our latest version took to arrive at the slowest node that has it. Waiting: seconds our latest version has been out while some copy still lacks it; 0 when none is behind.</p>\n" |
| 16 | text nsold "<p class=\"bad\">This snapshot is more than a day old: the node was shut down on 2026-11-14.</p>\n" |
| 17 | text nsnone "<h1>Node health</h1>\n<p class=\"bad\">Node health is not measured: the node writer's snapshot is missing or unreadable.</p>\n" |
| 18 | text nsth "<table class=\"stat\"><tr><th>Repository</th><th>We seed</th><th>Copies</th><th>Behind</th><th>Reach seconds</th><th>Waiting seconds</th></tr>\n" |
| 19 | text nstd1 "<tr><td><a href=\"" |
| 20 | text nstd1b "\">" |
| 21 | text nstd1c "</a></td><td>" |
| 22 | text nstd2 "</td><td>" |
| 23 | text nstd3 "</td></tr>\n" |
| 24 | text nstend "</table>\n" |
| 25 | text nssall "all" |
| 26 | text nssfol "followed" |
| 27 | text nssno "no" |
| 28 | text nsjs1 "{\"source\":\"the last snapshot of this forge's node, shut down on 2026-11-14\",\"measured\":" |
| 29 | text nsjs1b ",\"checked\":" |
| 30 | text nsjs1c ",\"age_s\":" |
| 31 | text nsjs2 ",\"peers\":" |
| 32 | text nsjs3 ",\"node\":\"did:key:" |
| 33 | text nsjs4 "\",\"repos\":[" |
| 34 | text nsjsn "{\"name\":\"" |
| 35 | text nsjsr "\",\"rid\":\"" |
| 36 | text nsjss "\",\"seeding\":\"" |
| 37 | text nsjsd "\",\"copies\":" |
| 38 | text nsjsb ",\"behind\":" |
| 39 | text nsjsl ",\"reach_s\":" |
| 40 | text nsjsw ",\"wait_s\":" |
| 41 | text nsjse "]}" |
| 42 | text nsjtrue "true" |
| 43 | text nsjfals "false" |
| 44 | text nsctj "application/json" |
| 45 | global nsat ulong 1 |
| 46 | global nspr ulong 1 |
| 47 | global nscomma ulong 1 |
| 48 | global nsf ulong 8 |
| 49 | global nse ulong 1 |
| 50 | fn nsdig c uchar to bool |
| 51 | if and ge c 48 le c 57 |
| 52 | ret true |
| 53 | end |
| 54 | ret false |
| 55 | end |
| 56 | fn nssafe c uchar to bool |
| 57 | if nsdig c |
| 58 | ret true |
| 59 | end |
| 60 | if and ge c 97 le c 122 |
| 61 | ret true |
| 62 | end |
| 63 | if and ge c 65 le c 90 |
| 64 | ret true |
| 65 | end |
| 66 | if eq c 32 |
| 67 | ret true |
| 68 | end |
| 69 | ret false |
| 70 | end |
| 71 | fn nseol p ulong n ulong to ulong |
| 72 | j = p |
| 73 | while lt j n bound 16777216 |
| 74 | if eq get fxo j 10 |
| 75 | ret j |
| 76 | end |
| 77 | j = add j 1 |
| 78 | end |
| 79 | ret n |
| 80 | end |
| 81 | fn nsnum p ulong e ulong to ulong |
| 82 | v = ulong 0 |
| 83 | if ge p e |
| 84 | ret 0 |
| 85 | end |
| 86 | for i ulong sub e p bound 20 |
| 87 | c = get fxo add p i |
| 88 | if not nsdig c |
| 89 | ret v |
| 90 | end |
| 91 | v = add mul v 10 sub ulong c 48 |
| 92 | end |
| 93 | ret v |
| 94 | end |
| 95 | fn nsskip p ulong e ulong to ulong |
| 96 | j = p |
| 97 | while lt j e bound 80 |
| 98 | if eq get fxo j 32 |
| 99 | ret add j 1 |
| 100 | end |
| 101 | j = add j 1 |
| 102 | end |
| 103 | ret e |
| 104 | end |
| 105 | note nsrid: the RID at fxo[a, a+n) is allow-list row fridx (false when it is not listed) |
| 106 | fn nsrid a ulong n ulong to bool |
| 107 | for i ulong get fan 0 bound FAMAX |
| 108 | if eq n get fail i |
| 109 | same = true |
| 110 | for k ulong n bound 64 |
| 111 | if ne get fxo add a k fridbyte i k |
| 112 | same = false |
| 113 | end |
| 114 | end |
| 115 | if same |
| 116 | put fridx 0 i |
| 117 | ret true |
| 118 | end |
| 119 | end |
| 120 | end |
| 121 | ret false |
| 122 | end |
| 123 | note nsdigs: fxo[p, e) is 1..19 decimal digits (so nsnum below never passes its bound and never wraps) |
| 124 | fn nsdigs p ulong e ulong to bool |
| 125 | if or le e p gt sub e p 19 |
| 126 | ret false |
| 127 | end |
| 128 | for k ulong sub e p bound 19 |
| 129 | if not nsdig get fxo add p k |
| 130 | ret false |
| 131 | end |
| 132 | end |
| 133 | ret true |
| 134 | end |
| 135 | note nsshape: fxo[p, e) is exactly "RID scope copies behind reach wait": a RID of 1..64 letters or digits, |
| 136 | note five fields of 1..19 digits, single spaces, at most 200 bytes. Every later loop over the line |
| 137 | note (nsone, nsrid, nsskip, nsnum) stays inside its bound only because the line has this shape. |
| 138 | fn nsshape p ulong e ulong to bool |
| 139 | if or le e p gt sub e p 200 |
| 140 | ret false |
| 141 | end |
| 142 | f = ulong 0 |
| 143 | run = ulong 0 |
| 144 | for k ulong sub e p bound 200 |
| 145 | c = get fxo add p k |
| 146 | if eq c 32 |
| 147 | if eq run 0 |
| 148 | ret false |
| 149 | end |
| 150 | f = add f 1 |
| 151 | run = ulong 0 |
| 152 | continue |
| 153 | end |
| 154 | if eq f 0 |
| 155 | if or not nssafe c ge run 64 |
| 156 | ret false |
| 157 | end |
| 158 | else |
| 159 | if or not nsdig c ge run 19 |
| 160 | ret false |
| 161 | end |
| 162 | end |
| 163 | run = add run 1 |
| 164 | end |
| 165 | ret and eq f 5 gt run 0 |
| 166 | end |
| 167 | note nsload: read the snapshot into fxo; header lines checked (format 2, time and peers as 1..19 digits, |
| 168 | note our node id) |
| 169 | fn nsload to bool |
| 170 | fpb |
| 171 | fpt nssnap |
| 172 | n = frdall |
| 173 | if le n 0 |
| 174 | ret false |
| 175 | end |
| 176 | ln = get fxol 0 |
| 177 | p = ulong 0 |
| 178 | e = nseol p ln |
| 179 | if ne sub e p 1 |
| 180 | ret false |
| 181 | end |
| 182 | if ne get fxo p 50 |
| 183 | ret false |
| 184 | end |
| 185 | p = add e 1 |
| 186 | e = nseol p ln |
| 187 | if not nsdigs p e |
| 188 | ret false |
| 189 | end |
| 190 | put nsat 0 nsnum p e |
| 191 | p = add e 1 |
| 192 | e = nseol p ln |
| 193 | if ne sub e p len tfnid |
| 194 | ret false |
| 195 | end |
| 196 | for k ulong len tfnid bound 64 |
| 197 | if ne get fxo add p k get tfnid k |
| 198 | ret false |
| 199 | end |
| 200 | end |
| 201 | p = add e 1 |
| 202 | e = nseol p ln |
| 203 | if not nsdigs p e |
| 204 | ret false |
| 205 | end |
| 206 | put nspr 0 nsnum p e |
| 207 | ret true |
| 208 | end |
| 209 | fn nsd2 v ulong to void |
| 210 | fputc uchar add div v 10 48 |
| 211 | fputc uchar add rem v 10 48 |
| 212 | end |
| 213 | note nsdate: unix seconds as YYYY-MM-DD HH:MM (UTC, proleptic Gregorian; as browse brdate) |
| 214 | fn nsdate t ulong to void |
| 215 | z = add div t 86400 719468 |
| 216 | era = div z 146097 |
| 217 | doe = sub z mul era 146097 |
| 218 | yoe = div sub add sub doe div doe 1460 div doe 36524 div doe 146096 365 |
| 219 | y = add yoe mul era 400 |
| 220 | doy = sub doe sub add mul 365 yoe div yoe 4 div yoe 100 |
| 221 | mp = div add mul 5 doy 2 153 |
| 222 | d = add sub doy div add mul 153 mp 2 5 1 |
| 223 | m = add mp 3 |
| 224 | if ge mp 10 |
| 225 | m = sub mp 9 |
| 226 | end |
| 227 | if le m 2 |
| 228 | y = add y 1 |
| 229 | end |
| 230 | fnum y |
| 231 | fputc 45 |
| 232 | nsd2 m |
| 233 | fputc 45 |
| 234 | nsd2 d |
| 235 | fputc 32 |
| 236 | s = rem t 86400 |
| 237 | nsd2 div s 3600 |
| 238 | fputc 58 |
| 239 | nsd2 div rem s 3600 60 |
| 240 | end |
| 241 | fn nsage to ulong |
| 242 | now = ulong div realns 1000000000 |
| 243 | t0 = get nsat 0 |
| 244 | if le now t0 |
| 245 | ret 0 |
| 246 | end |
| 247 | ret sub now t0 |
| 248 | end |
| 249 | fn nsscope v ulong to void |
| 250 | if eq v 2 |
| 251 | fput nssall |
| 252 | ret |
| 253 | end |
| 254 | if eq v 1 |
| 255 | fput nssfol |
| 256 | ret |
| 257 | end |
| 258 | fput nssno |
| 259 | end |
| 260 | note nsone: one allow-listed data line at fxo[p, e): field starts into nsf (0 RID start, 1 RID length, |
| 261 | note 2 scope, 3 copies, 4 behind, 5 reach, 6 wait), then the HTML or JSON row |
| 262 | fn nsfld j ulong to ulong |
| 263 | ret nsnum get nsf j get nse 0 |
| 264 | end |
| 265 | fn nshrow to void |
| 266 | i = get fridx 0 |
| 267 | fput nstd1 |
| 268 | fputb |
| 269 | fput tfowner |
| 270 | fputc 47 |
| 271 | fputrn i |
| 272 | fput nstd1b |
| 273 | fputrn i |
| 274 | fput nstd1c |
| 275 | nsscope nsfld 2 |
| 276 | for j ulong 4 |
| 277 | fput nstd2 |
| 278 | fnum nsfld add j 3 |
| 279 | end |
| 280 | fput nstd3 |
| 281 | end |
| 282 | fn nsjrow to void |
| 283 | i = get fridx 0 |
| 284 | if eq get nscomma 0 1 |
| 285 | fputc 44 |
| 286 | end |
| 287 | put nscomma 0 1 |
| 288 | fput nsjsn |
| 289 | fputrn i |
| 290 | fput nsjsr |
| 291 | p = get nsf 0 |
| 292 | for k ulong get nsf 1 bound 64 |
| 293 | fputc get fxo add p k |
| 294 | end |
| 295 | fput nsjss |
| 296 | nsscope nsfld 2 |
| 297 | fput nsjsd |
| 298 | fnum nsfld 3 |
| 299 | fput nsjsb |
| 300 | fnum nsfld 4 |
| 301 | fput nsjsl |
| 302 | fnum nsfld 5 |
| 303 | fput nsjsw |
| 304 | fnum nsfld 6 |
| 305 | fputc 125 |
| 306 | end |
| 307 | fn nsone p ulong e ulong html bool to void |
| 308 | sp = p |
| 309 | for k ulong sub e p bound 80 |
| 310 | if eq get fxo add p k 32 |
| 311 | sp = add p k |
| 312 | break |
| 313 | end |
| 314 | end |
| 315 | if eq sp p |
| 316 | ret |
| 317 | end |
| 318 | if not nsrid p sub sp p |
| 319 | ret |
| 320 | end |
| 321 | put nse 0 e |
| 322 | put nsf 0 p |
| 323 | put nsf 1 sub sp p |
| 324 | q = add sp 1 |
| 325 | put nsf 2 q |
| 326 | for j ulong 4 |
| 327 | q = nsskip q e |
| 328 | put nsf add j 3 q |
| 329 | end |
| 330 | if html |
| 331 | nshrow |
| 332 | ret |
| 333 | end |
| 334 | nsjrow |
| 335 | end |
| 336 | fn nsrows html bool to void |
| 337 | ln = get fxol 0 |
| 338 | p = ulong 0 |
| 339 | for skip ulong 4 |
| 340 | if ge p ln |
| 341 | ret |
| 342 | end |
| 343 | p = add nseol p ln 1 |
| 344 | end |
| 345 | put nscomma 0 0 |
| 346 | for it ulong 4096 |
| 347 | if ge p ln |
| 348 | ret |
| 349 | end |
| 350 | e = nseol p ln |
| 351 | if nsshape p e |
| 352 | nsone p e html |
| 353 | end |
| 354 | p = add e 1 |
| 355 | end |
| 356 | end |
| 357 | fn nsjson ok bool to long |
| 358 | put fkind 0 1 |
| 359 | fsetct nsctj |
| 360 | fput nsjs1 |
| 361 | if ok |
| 362 | fput nsjtrue |
| 363 | fput nsjs1b |
| 364 | fnum get nsat 0 |
| 365 | fput nsjs1c |
| 366 | fnum nsage |
| 367 | fput nsjs2 |
| 368 | fnum get nspr 0 |
| 369 | else |
| 370 | fput nsjfals |
| 371 | end |
| 372 | fput nsjs3 |
| 373 | fput tfnid |
| 374 | fput nsjs4 |
| 375 | if ok |
| 376 | nsrows false |
| 377 | end |
| 378 | fput nsjse |
| 379 | ret 200 |
| 380 | end |
| 381 | fn nsstat to long |
| 382 | ok = nsload |
| 383 | if fpeq tfstj |
| 384 | ret nsjson ok |
| 385 | end |
| 386 | fsetti nstit |
| 387 | if not ok |
| 388 | fput nsnone |
| 389 | ret 200 |
| 390 | end |
| 391 | fput nsh1 |
| 392 | nsdate get nsat 0 |
| 393 | fput nsh2 |
| 394 | age = nsage |
| 395 | fnum age |
| 396 | fput nsh3 |
| 397 | fnum get nspr 0 |
| 398 | fput nsh4 |
| 399 | if gt age 86400 |
| 400 | fput nsold |
| 401 | end |
| 402 | fput nsth |
| 403 | nsrows true |
| 404 | fput nstend |
| 405 | ret 200 |
| 406 | end |