summaryrefslogtreecommitdiff
path: root/src/Plumb.zig
Commit message (Collapse)AuthorAge
* plumber: the pager sends (docs/next-plumber.md, phase 4): a +Pager filled ↵Gabriel Schneider14 hours
| | | | with a diff (File.looksLikeDiff, pager_diff) is a plumbing message, as acme's `plumb -i` sends what it shows: fillPager's last call is Plumb.paged, which sends src pager, dst edit, wdir the +Pager's directory, type text/x-diff, `action=showdata filename=<the +Pager's name>` (quoted as mesg.c quotes), the text as data; the default rules' last set makes it showdiff (attr delete action, attr add action=showdiff, plumb to edit), and the edit port's showdata and showdiff (Plumb.show, acme's plumbshow) show the data in the pane filename names, the sender's own first, else a new clean pane of that name, showdiff then restacking it in a +Diff in its place (hunks.paged, the code the pager's hook called, unchanged); text paged that is no diff is not sent, where the record had every page sent: the look rules would read it whole, `type is text` holding (a `matches` over a MiB of output, up to the regular expressions' 300 ms budget, at each page), and a page of one line naming a file would ask the disk; the rules in force are read once and kept until their text changes (Plumb.parsed, by its hash, derived state: each process's own), measured in a fast build per send: 29k instructions to read the default rules, a URL's send 37k before, 8.3k after, a word's look 69k before, 40k after, a look that opens a file 262k before (its send 63k), 233k after (34k); test: a diff paged is stacked by the default rule, text that is no diff stays a +Pager, without the rule the +Pager stays as text, and another sender's showdata and showdiff; the design record gains what phases 2-4 did otherwise (detached starts with no output kept, only diffs paged sent, own ports asking nobody, the rules read once); plumber.zig's defaults end with the paged rule; the reference, the default rules' file and the changelog say so
* plumber: external ports (docs/next-plumber.md, phase 3): every port a rule ↵Gabriel Schneider14 hours
| | | | names has a file, plumb/<port> (0444), listed after rules and send in the order rules named them and never dropped (Plumb.ports, dumped: seeded at boot from the rules in force, grown by each apply, refused past 32), its node a third family in the tree beside panes and columns (Node.ofPort, Target.port; port_bit is 1 << 40, clear of the host tree's and the archive's high bits, which 1 << 57 hit); an open reads (Open.what.port, an events.Queue of its own, 64 KiB): the messages sent from then on, packed, one a read, a short read the front and the next the rest, a read with none held until one comes (p.fs.news, answered by the listener as event reads are); every open gets its copy (fanOut, plumber(4)'s queuesend), one over the queue is not sent to it and the log says so; a port pardes reads itself (edit, web, a loaded kind) hands its readers copies without asking anyone, so a look stays speculated whole; another port's readers are the authority's to know, asked through tape.authority (a replica's own look waits for the first answer and guesses the last), with none its rule set's start runs, or its client, the message held in p.fs.plumb_held for the port's first opener (Plumb.opened, plumber(4)'s queueheld); test: plumber.zig, two opens of plumb/edit each read a look's message while the file opens, an open made after reads nothing, a client's message reaches the first opener and the next goes to the reader with nothing started, a port is not written; monkey9p.zig gains the plumb/ files, rules and messages that start no program, the ports' reads as held reads, and plumb/rules' rest read at the close (whose refusal is the log's alone, as a line file's: restAtClose); replicas.zig: a look to a port a program reads, the second of a replica's own speculated whole and confirmed, digests equal; tree.zig's readdir test lists web and edit; the reference's tree and plumber section, fs-help and the changelog say so
* plumber: a look sends what it looks at (docs/next-plumber.md, phase 2): ↵Gabriel Schneider14 hours
| | | | after the pane's own readings and once a name already open in a pane is focused (never sent), lookAt sends the trimmed name, type text, src pardes (term from a raw terminal, a kind's name from its pane), wdir the pane's directory, with what resolveLookTarget found of it (Plumb.Seen: isfile and isdir take it, so no second stat and Look's own readings of a URL or `//` stay no file); a message the rules give back to `edit` as sent is Look's own (Sent.look) and runs lookAt's switch on that target, one nothing takes or a started word declines is Look's own too, whose `.url` arm is now the word's search; the edit port's open of another message runs with look_text, which now means "unplumbed", so the edit port's lookAt never sends again (the recursion trap); the three diff hooks become the default rules of the record's §5.2 (a bare .diff/.patch to `Diff $file`, a commit hash in the editor to `Diff $0`, after the two edit sets), and `Diff` takes a file or a revision, a rule's Diff declining in silence (Pardes.plumb_declined) where it cannot (no hunk, not readable, no .git above): hunks.lookedAt and lookedAtCommit go, their bodies in hunks.word, the `needs` check of the bare form in the word, PaneKind.diff gone; the old one-line `Plumb` word, Core.plumb, look.Port, plumbRuleError, plumbTarget and resolve's rules block go: bare, `Plumb` opens <config>/plumbing as Config opens init (both through builtins.openConfigFile; `include basic` in a new one), an argument is refused in words, Save applies it (host_io.writeFile beside reapplyInitFile, Plumb.saved), and boot reads it (Plumb.boot in applyStartupConfig); a started program now runs detached as Plan 9's plumber's (the coordinator's decision for the user's question 4): Effect.start, every host's host_io.startDetached (double fork, setsid, /dev/null for 0-2, every other fd closed, argv exec'd in wdir with no shell, the child's errno back through a close-on-exec pipe, said as `plumb start: <prog>: <why>`), so exec_dir goes; resolveLookTarget's and Plumb.Send.search's directory walk is one look.Dirs; test: look.zig's Plumb test rewritten onto the rules (a rule's word, an open pane unsent, the hover's resolve, a URL with no web rule searched for) and a hash inside and outside a git work tree; addons.zig's Plumb test onto plumb/rules (a port no kind reads, its kind gone: Look's own); Plumb.zig: the word, the save and boot; replicas.zig gains a URL (speculated whole, confirmed, no rollback) and a hash, each the authority's and a replica's own; every look golden unchanged; the reference quotes src/plumbing whole and says the order, the changelog says so
* plumber: Plan 9's plumber in the core, its language and its files ↵Gabriel Schneider14 hours
(docs/next-plumber.md, phase 1): src/Plumb.zig owns the rules, kept as their text (Core.plumber, digested and dumped; `include basic`'s, the embedded src/plumbing, until any are written, so a session and a dump from before it start with the defaults) and parsed again for each message, and a matcher over them read from rules.c and match.c: the message's pack and unpack (plumbunpackpartial's whole, short of its data, malformed), packed attributes read and quoted rc's way, rule sets of `object verb arg` lines, variables, include (basic, the configuration directory's, an absolute path, through the taped read site), rc's quoting and `$` expansion at parse and at match, every parse refusal in rules.c's words with its file and line, `$1`-`$9` refused in words (the regular expressions have no capture groups), `matches` over regexp.zig whole (`^(...)$`) or around a click counted in runes with Pike's two patterns, `is`, `set` rewriting for good, `add`, `delete` failing on an attribute not there as match.c's code does, `isfile` and `isdir` finding a name as Look does (past its place, the message's directory, a look's jump list's, Incl's) at the taped resolve sites, once a send; dispose to a port pardes reads (edit: opened as a look opens it, at addr=; web: the host's link opener; a loaded kind by its name), to a rule set's start or client run as exec runs a line (a builtin in place, else a command pane in the message's wdir: Core.exec_dir, exec.runCommand's reuse skipping the sender), or Plan 9's words for what went nowhere; rules print back in the order they were written, a variable where it was set, so a printed text reads back the same; plumb/rules (a write adds rule sets as each is whole, the rest at the close, `>` replaces them, one writer at a time) and plumb/send (a message put together across writes) in the tree, with fs-help's line, the reference's section and tree, and the fstree test's paths; nothing calls the plumber from Look yet; test: Plumb.zig's eleven (every parse error, print and read back, plan9port's basic less its submatch rule sets, its ¡-￿ classes UTF-8's bytes, whole and click matches with horse.gift, quoting, a set's rewrite kept, delete of an absent attribute, dst filtering, isfile and isdir, dispose, a dump keeping the rules), test/behaviour/plumber.zig's two through the tree (Session records the link a host would open); the root's listings in tree.zig's and the process tests gain plumb, and the README folds a blank line to stay 45 lines; the changelog says so Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T