From f3405aaef8db79094b2741a9caaeaa5328ab6288 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 13:47:11 -0300 Subject: Store 2/3: one bounded store every window shares (Store.zig): Recent as records read on use, the panes a session closes kept as one-pane dumps; Panes lists them (closed), Enter or a look at @pN brings one back beside the pane that took its rows An append-only log under $XDG_STATE_HOME/pardes/store, framed records with a CRC, flock on store.lock (never blocking a step), a stat on use, garbage passed over and compacted away by the next writer, compaction by rename, 100 MiB cap. dump.dumpPane/restorePane lifted out of dumpState/initDump; layout.giveBack; Options.recent_path is store_path. Host calls yield one at a time; /recent refreshes only when no step is out. Tests: two windows and a busy lock, the cap, garbage/torn/partial records, a closed pane's reopen with the layout invariant; fs.py: two live sessions over 9P. --- src/ninep/tree.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ninep/tree.zig') diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 59ef5ef4..7b107ea7 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1110,6 +1110,10 @@ fn readFile(p: *Pardes, req: Req, target: Target) Reply { .ctl => ctl.readRoot(p, req), .commands => ctl.readCommands(p, req), .recent => recent: { + // Every window's files: what the others wrote since, read, + // unless a step is out mid-syscall (nothing may change the + // core under it): then the list as it was. + if (pardes.turn.out == 0) p.store.refresh(p); var text: std.Io.Writer.Allocating = .init(p.scratch.allocator()); pardes.panes.Output.recentText(p, &text.writer, false) catch break :recent Reply.fail(req.tag, E.NOMEM); p.fs.stage(p.gpa).appendSlice(p.gpa, text.written()) catch break :recent Reply.fail(req.tag, E.NOMEM); -- cgit v1.3