summaryrefslogtreecommitdiff
path: root/src/verbs.zig
Commit message (Collapse)AuthorAge
* Fsys: a deadline on every call, so a silent server is a timeoutGabriel Schneider4 hours
| | | | | | | | | | | | | | | | | | | | | | | A server that accepted and then said nothing held the caller for ever: Fsys read its socket with no limit, the version in init included, while pardes's own client gives a call 2 s and a write that runs a command 30 s. Fsys gains one field, `timeout` (an Io.Timeout), which init sets to `default_timeout`, 30 s, before it speaks; each call's answer is read by operateTimeout until that long after the call is sent, and past it the call is error.Timeout (the answer may come yet, under a tag the next call does not expect, so the connection is to be closed). `.none` waits for ever: verbs' follow sets it, since following an event file waits as long as the events take; read, ls, ask and the rest keep the deadline and say "no answer in 30000 ms; fs follow waits for ever". Test: a held read nobody feeds, on a 100 ms timeout, is error.Timeout after 90-5000 ms (poll counts whole milliseconds). cloud9's test 108 of 108; serve's "two clients at once" and "repeated connect/disconnect" failed once each at load 13 and passed in the four runs after, as on the base: they do not touch Fsys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* verbs: the fs verbs as a function a program calls with a dialled treeGabriel Schneider4 hours
The user wants each app's binary to drive the tree it serves ("the cli should be like a living documentation, similar to 9p"): `pardes fs read pane/3/body`, `drat-meout fs read state/scene`. verbs.run(&fsys, args, stdin, stdout, stderr) is that command line, added in five lines (the top of the file shows them): ls, read, write (the words and a newline, or stdin a write a read of it, as 9p write), ask (write then read one open), follow (ask, or read: each answer flushed as it comes), stat (Plan 9's mode letters, length, uid, gid, mtime, name), help and complete. Exit status 0, or 1 with the server's own words on stderr; a verb not known is the usage. help PATH reads the tree's /README: a line is about the file its first word names, a path from the root with a leading or trailing slash or a comma dropped and <anything> standing for one name, and about everything under it; lines after it indented deeper go with it. pardes's src/fs-help.txt, 9proc's and 9agents' READMEs are in that shape already; sketchbook's control tree serves none yet and would write one so. complete PREFIX lists the directory PREFIX ends in, the names it starts, as paths, a trailing slash on a directory. Tests drive run() against TestTree in process: listings, reads, stats, completion, refusals in the server's words, stdin writes, ask, help including the line matcher on pardes's and 9proc's shapes, follow of three held chunks and a hangup mid-read, and the usage. Also run by hand from a scratch program of those five lines against a 9proc-demo on a Unix socket.