summaryrefslogtreecommitdiff
path: root/core/dump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 23:53:14 -0300
committerGabriel Schneider <[email protected]>2026-11-22 23:56:41 -0300
commitf52b6256927431e90af58af2f91eaac7e9799bf5 (patch)
treeabd5e1e04d0ce1896ff6fc17168d4d59e232ebde /core/dump.zig
parentaee54cf0a3a328b4ec704bc2c59996428c35f6e8 (diff)
downloadpardes-f52b6256927431e90af58af2f91eaac7e9799bf5.tar.gz
pardes-f52b6256927431e90af58af2f91eaac7e9799bf5.zip
dump: a join's dump and its digest are one moment: the dump asks the host nothing and hands back the digest it was made at: a client that came back while 9P requests were live (a script reading /screen, the /mnt/9p mount) loaded the session's dump and refused it as another session's, exiting for good while its session was there (fault D, reports/pardes-upgrade-back.md: the upgrade row's rejoin, about 3 in 75 on one CPU, and its family in pair_exec_reaps): the join's dump stat'd each pane's file for which were on disk (core/dump.zig `dumpWith` -> `onDisk` -> exec.kindOf, a `.kind` tape site that gives up the turn, tape.out), a 9P open, read or release (none waits for quiet: ninep/tree.zig `needsQuiet`) was answered in that gap by a connection task, and `Peers.join` then took the welcome's digest over the moved `fs` (tape.digestOf after the dump): the client's load, from before the request, could not be it; and the request, recorded after the join's cut, was in the client's next unit too; `fs` is ruled replicated state, as it was: every 9P request is a taped input each replica replays (Core.zig `serveFs`), a write on an open reads its record (the half line, the results, the lock, the held writes: the previous change's fifteen kinds, the tests at the replica's surface below them), and its dump carries what its digest hashes (the property's 300 joins); what was wrong was the moment, not the field; now `dumpJoin` returns `.{ bytes, digest }`, the digest taken in it after the dump with nothing between, `Peers.join` and `Authority.join` take it from there (no caller can take it at another moment), a join's dump writes `on_disk` as none (only a revival reads it, from an image: `image` keeps its stat; a client's load discards it: loadKnowing's `on_disk` is null for `load`), and a turn given up while the dump is made fails it (`error.TurnGivenUp`: the join is refused in words, `that session could not be dumped`, never loaded otherwise); `byteDump` (tests only) is the join's dump with its blobs in place, as its tests take it; the previous change's moment test passes (the join asks the host nothing: the stat that let the request in is never made, the turn's yields do not move); core-test under the filter `join` 52/61 (9 skipped)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/dump.zig')
-rw-r--r--core/dump.zig26
1 files changed, 19 insertions, 7 deletions
diff --git a/core/dump.zig b/core/dump.zig
index c3742a21..82098449 100644
--- a/core/dump.zig
+++ b/core/dump.zig
@@ -259,13 +259,26 @@ pub fn image(p: *Pardes, name: []const u8) ![]u8 {
/// out and noted in `deferred` (they are the session's, alive while pinned:
/// memory.zig `pin`), each terminal whole (as the join's step reloaded it
/// on every side: panes.reloadTerminals), its sequence in flight with it.
-/// What is left is the session's mutable state, made in its step.
-pub fn dumpJoin(p: *Pardes, deferred: *std.ArrayListUnmanaged(walk.Deferred)) ![]u8 {
+/// What is left is the session's mutable state, made in its step. With it
+/// the session's digest at that moment, which the client checks its load
+/// by.
+///
+/// One moment: nothing in it gives up the turn (pardes.turn: a host call
+/// does, tape.out), or a 9P request answered meanwhile is in the dump and
+/// in the client's next unit both, and moves the core between the dump and
+/// the digest: the client then refused its own load and went (a script
+/// reading /screen at a rejoin, 2026-11-22). So a join's dump asks the host
+/// nothing (`on_disk`, a revival's, is none in it).
+pub fn dumpJoin(p: *Pardes, deferred: *std.ArrayListUnmanaged(walk.Deferred)) !struct { bytes: []u8, digest: u64 } {
// The join's file reads are the session's host's, between its steps:
// with its io, which the core's tape holds (a walk's hook takes no more).
join_files = p.tape.io;
defer join_files = null;
- return dumpWith(p, deferred);
+ const yields = pardes.turn.yields;
+ const bytes = try dumpWith(p, deferred);
+ errdefer p.gpa.free(bytes);
+ if (pardes.turn.yields != yields) return error.TurnGivenUp;
+ return .{ .bytes = bytes, .digest = pardes.tape.digestOf(p) };
}
/// `dumpExit`'s: a terminal dumps its size, not its emulator.
@@ -281,10 +294,9 @@ fn dumpWith(p: *Pardes, deferred: ?*std.ArrayListUnmanaged(walk.Deferred)) ![]u8
try d.put(Pardes, p);
const mounts: []const filesystem.Mount = p.fs.mounts.items;
try d.put([]const filesystem.Mount, &mounts);
- var on_disk: OnDisk = @splat(false);
- for (p.panes, &on_disk) |slot, *on| if (slot) |pane| {
- on.* = onDisk(p.tape, pane);
- };
+ // Which files were on disk is a revival's (`image`): a client's load
+ // never reads it, and a join asks the host nothing.
+ const on_disk: OnDisk = @splat(false);
try d.put(OnDisk, &on_disk);
const theme: []const u8 = colors.themes[@min(p.settings.theme, colors.themes.len - 1)].name;
try d.put([]const u8, &theme);