summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 12:44:57 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit6fc9f416938b59b665b1fddc052402770a21cc3f (patch)
tree632e83ae787b6e1d231683514663188d3e73e4b9 /src/dump.zig
parentc8a3ecc3bcb36f0259f4d8ad2e0cdfcdc3183c9f (diff)
downloadpardes-6fc9f416938b59b665b1fddc052402770a21cc3f.tar.gz
pardes-6fc9f416938b59b665b1fddc052402770a21cc3f.zip
A Restore answers its writer before hanging up, and the log records dumps and restores
A client that wrote Restore saw its connection cut with no answer, and could not tell a Restore from a crash. The listener now lets the writer's answer out before the cut, and cuts only the old editor's connections, refusing their requests meanwhile; a client that dials during it is the new editor's and stays. Dump logs 'dump <path>' and the restored editor's log 'restore <path>'. Keeping connections across a Restore was weighed and left: the fids name the old editor's panes and opens, so it would mean carrying serials and open records into the new one, where acme's Load only adds windows. tty's Restore also closed its shells' ptys without reaping them; it retires them now. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dump.zig b/src/dump.zig
index 508e7300..3d0f0f0e 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -671,11 +671,15 @@ pub fn dumpState(p: *Pardes) !void {
p.emit(.write_dump);
}
-pub fn restore(p: *Pardes, zon_bytes: []const u8) !*Pardes {
+/// The replacement core for a Restore of the dump at `from`, whose log says
+/// so after its panes' `new`s, for a client that reconnects to read.
+pub fn restore(p: *Pardes, zon_bytes: []const u8, from: []const u8) !*Pardes {
var opts = p.opts;
opts.cols = p.screen_w;
opts.rows = p.screen_h;
- return initDump(p.gpa, opts, zon_bytes, p);
+ const replacement = try initDump(p.gpa, opts, zon_bytes, p);
+ pardes.ctlfs.events.notePath(replacement, "restore", from);
+ return replacement;
}
pub fn initFromDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8) !*Pardes {