summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 10:46:54 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:12 -0300
commitc0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8 (patch)
treefa4656b6d5e4203b8c52516d6695b8c7677de41d /src/pardes.zig
parent60a891ce8127c87b55aed1ff71e435cb7fbd28fc (diff)
downloadpardes-c0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8.tar.gz
pardes-c0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8.zip
store: Recent is a file of 200 lines under flock, written whole in place at the end of a step that changed it and read back under a session's own changes when another session wrote it since, and the panes a session closes are kept in its memory, the newest 64 within 64 MiB; the append-only CRC log with its resync and compaction, and the closed panes' self-describing dumps in it (only the session that closed one ever listed it), go; Options.store_path is recent_path ($XDG_STATE_HOME/pardes/recent), and the old store is read once while it is the newer of the two; tests: the store's four rewritten through the same windows (the 200 newest, a foreign file, a closed pane's way back from memory), the old store read once, 64 closed panes kept, recent.zig's merge; the process cases read Recent's file; docs/next-store.md is the decision
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index e65e48eb..32bf9cba 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -3719,10 +3719,10 @@ pub const Options = struct {
ninep_tcp: ?[]const u8 = null,
mounts: []const filesystem.Mount = &.{},
config_dir: ?[]const u8 = null,
- /// The store every window shares (Store.zig): the files opened lately,
- /// the panes closed. Set by the host that has a state directory; none,
- /// they last as long as the session.
- store_path: ?[]const u8 = null,
+ /// Recent's file, which every session of the user's shares (Store.zig).
+ /// Set by the host that has a state directory; none, Recent lasts as
+ /// long as the session.
+ recent_path: ?[]const u8 = null,
startup_config_path: ?[]const u8 = null,
image_allocator: ?std.mem.Allocator = null,
pdf_allocator: ?std.mem.Allocator = null,
@@ -3800,8 +3800,8 @@ pub const Pardes = struct {
/// The files opened lately, closed ones too (recent.zig): `Recent`,
/// /recent, and the jumplist's way back to a closed pane.
recent: recent_files.List = .{},
- /// Where Recent is kept, shared with every other window, and the panes
- /// this session closed, which Panes brings back (Store.zig).
+ /// Recent's file, shared with every other session, and the panes this
+ /// session closed, which Panes brings back (Store.zig).
store: Store = .{},
/// acme's Incl: the directories a look at a name that is nowhere else
/// (`stdio.h`, `<foo.h>`) is tried in, in order. The session's, seeded
@@ -4119,9 +4119,10 @@ pub const Pardes = struct {
"opts", "dump_out",
},
.derived = .{ "shell_rows", "diff_output", "locations_cache", "retired_panes", "tty_filter_palette", "body_chrome" },
- // The host's handles, the 9P server's fids and log, the store file
- // every window of the user shares (and Recent read from it), and
- // the files of a host with no file system of its own.
+ // The host's handles, the 9P server's fids and log, Recent's file
+ // every session of the user shares (and Recent read from it) with
+ // this session's closed panes, and the files of a host with no file
+ // system of its own.
.authority = .{ "host", "fs", "store", "recent", "fallback" },
.len = .{ .{ "jumps", "njumps" }, .{ "look_src", "n_look_src" }, .{ "leader_keys", "leader_n" }, .{ "col_x", "ncol" }, .{ "col_w", "ncol" }, .{ "session_dir", "session_dir_len" } },
};
@@ -4318,11 +4319,11 @@ pub const Pardes = struct {
return if (comptime hosted) std.heap.smp_allocator else p.gpa;
}
- /// The store read once at start: a new session's, Recent from it.
+ /// Recent's file read once at start: a new session's.
pub fn loadRecent(p: *Pardes) void {
// A replica's store is its own, in memory: the recording session's
- // file is every window's of its user (src/tape.zig).
- p.store = Store.init(if (tape.replaying()) null else p.opts.store_path);
+ // file is every session's of its user (src/tape.zig).
+ p.store = .{ .path = if (tape.replaying()) null else p.opts.recent_path };
p.store.load(p);
}