From fdf74e199de7d0fc648f912875323f3dc920ffc2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 29 Oct 2026 20:56:03 -0300 Subject: replica clients over a socket: the session streams each its dump and every unit after it (replica.zig `Peers`, a writer and a reader thread a client, units at each step boundary, a client's input stepped there in its own view), and `pardes --attach=:` and `--attach=:` (through `ssh -tt -L`) are a client in the tty host, its keys applied at once by its own replica and drawn by its own process wire.zig version 15: welcome (the client's id and view, the dump's length, the session's UTC offset and digest), dump pieces, units (with the authority's clocks), terminal messages both ways, a check. A unit carries one digest, at its end (`unit_digests`). The client: tty.zig `Shell.remote`, `feed` (a terminal's input to the replica and the session); the session's clock guessed from the last unit's (tape.zig `Guess`); a pump woken only by a client's post reads no new time (`mail_only`), and a unit of another's ending where the last ended leaves the speculation as it is (`neutral`); the rollback copy taken while idle (`Replica.ready`); views a frontend here does not draw left undrawn. A lagging client never holds the session: its queue is cut off past 64 MiB (PARDES_REPLICA_LAG_KB). Detach in a client ends that client; a Restore lets every client go. daemon.zig: a replica the daemon hands over is the session's loop's (a note), not a stub thread's. A window session refuses one in words. test/daemon.py `--clients`: two clients (one through the delay relay) type into a detached session and agree with it, one killed outright, one detached, a third typing into a shell. Co-Authored-By: Claude Opus 5.5 --- test/rollback_bench.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/rollback_bench.zig') diff --git a/test/rollback_bench.zig b/test/rollback_bench.zig index 38fe011d..0f0c77a4 100644 --- a/test/rollback_bench.zig +++ b/test/rollback_bench.zig @@ -158,6 +158,24 @@ pub fn main(init: std.process.Init) !void { x.* = t1 - t0; y.* = nowNs() - t1; } + // A join (docs/next-daemon.md, Phase 5 part B notes): the session + // dumped at a step boundary, which is what the authority pays, and + // the joiner's load of it. + var dump: [5]u64 = undefined; + var load: [5]u64 = undefined; + var dump_len: usize = 0; + for (&dump, &load) |*x, *y| { + const t0 = nowNs(); + const bytes = try pardes.dump.dumpBytes(core); + const t1 = nowNs(); + dump_len = bytes.len; + const loaded = try pardes.dump.load(gpa, .{ .tty_only = true, .image_allocator = gpa, .pdf_allocator = gpa, .tree_sitter_allocator = gpa, .frame_allocator = gpa }, bytes, null); + y.* = nowNs() - t1; + x.* = t1 - t0; + loaded.deinit(); + core.gpa.free(bytes); + } + std.debug.print("{s:<8} join: dump {d:.1} MB in {d:.2} ms (the session's step), load {d:.2} ms (the joiner's)\n", .{ s.name, @as(f64, @floatFromInt(dump_len)) / 1e6, @as(f64, @floatFromInt(median(&dump))) * 1e-6, @as(f64, @floatFromInt(median(&load))) * 1e-6 }); var panes: usize = 0; for (core.panes) |slot| panes += @intFromBool(slot != null); const ms = 1e-6; -- cgit v1.3