diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 05:58:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 10:44:19 -0300 |
| commit | ddb2554fff073eed0b73a43825b2c007c895bc4d (patch) | |
| tree | 77db8d82afd23dc6e0395bc4ba21525bc6c8dfcd /src/main.zig | |
| parent | 541ebfa62ed966d74e1b7e93eb0d62e536d50e7d (diff) | |
| download | pardes-ddb2554fff073eed0b73a43825b2c007c895bc4d.tar.gz pardes-ddb2554fff073eed0b73a43825b2c007c895bc4d.zip | |
replica: a far client's content cache and zstd: the session lists its join's blobs by BLAKE3 hash first (wire 16 `blobs`), the client finds each in the core it leaves or on disk ($XDG_CACHE_HOME/pardes/blobs, hashed again on load, a bad file a miss, the least recently used evicted past 1 GiB) and asks for the rest (`want`), and everything after the welcome goes in zstd envelopes (level 6 over 8 MiB for the join, an undo snapshot being a near copy of its text, then level 3), so `ssh -C` leaves the default command; a far client (through ssh, or PARDES_REPLICA_FAR) keeps what it was sent and, at its end, what it made; a hangup ends a remote client the normal way; through the box a client holding the blobs is drawn in 2.4 s where main took 7.0 to 11.9, and a first join of a session with undo in 7.1 s where main took 11.9; libzstd 1.5.7 vendored, its allocations on c_heap, a second copy refused by shared-libs-check; tests for the cache's verify-on-load, its eviction and a far join's blobs sent once; test/daemon.py's far clients
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.zig b/src/main.zig index ce1c5bba..fafafc08 100644 --- a/src/main.zig +++ b/src/main.zig @@ -884,7 +884,7 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, } }; if (std.mem.indexOfScalar(u8, where, '/') != null) { - @import("tty/tty.zig").remote(init, opts, where, name) catch |err| Say.no(io, "{t}", .{err}); + @import("tty/tty.zig").remote(init, opts, where, name, false) catch |err| Say.no(io, "{t}", .{err}); std.process.exit(0); } // ssh -L <here>:<there> <host>, until the socket here answers. @@ -902,10 +902,12 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, var argv: [48:null]?[*:0]const u8 = @splat(null); var n: usize = 0; var words_buf: [1024]u8 = undefined; - // Compressed by default: the join's dump is text, and the FreeBSD box's - // link carries 170 to 400 KB/s (a 3.9 MB join: 7.8 s plain, 5.4 with - // -C). $PARDES_SSH, when set, is the whole command. - var words = std.mem.tokenizeScalar(u8, std.mem.span(std.c.getenv("PARDES_SSH") orelse "ssh -C"), ' '); + // Not `ssh -C`: what the session sends a far client is zstd already + // (replica.zig), and zlib over it costs both ends' time for nothing. + // ponytail: what the client sends goes as it is, keys and a paste + // alike; a big paste through a slow link is the ceiling, and would be + // an envelope of its own. $PARDES_SSH, when set, is the whole command. + var words = std.mem.tokenizeScalar(u8, std.mem.span(std.c.getenv("PARDES_SSH") orelse "ssh"), ' '); var at: usize = 0; while (words.next()) |w| { if (n >= 40 or at + w.len + 1 > words_buf.len) Say.no(io, "PARDES_SSH has too many words", .{}); @@ -953,7 +955,7 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, const ts: std.c.timespec = .{ .sec = 0, .nsec = 10 * std.time.ns_per_ms }; _ = std.c.nanosleep(&ts, null); } - @import("tty/tty.zig").remote(init, opts, here, name) catch |err| { + @import("tty/tty.zig").remote(init, opts, here, name, true) catch |err| { Ssh.end(); Say.no(io, "{t}", .{err}); }; |
