summaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 23:28:13 -0300
committerGabriel Schneider <[email protected]>2026-11-17 23:42:48 -0300
commit9b20d00ca5ffbab640b87249d65e4165414d22c1 (patch)
treee62644195d40b5a41ed92a5e19548fa84cff4821 /src/fs.zig
parent6c61169832d6f396ee7a6e9e0b09d9c055d08f8d (diff)
downloadpardes-9b20d00ca5ffbab640b87249d65e4165414d22c1.tar.gz
pardes-9b20d00ca5ffbab640b87249d65e4165414d22c1.zip
replica: a record of a MiB or more crosses to a client by its hash, beside its unit (tape.zig by_hash_min, Big; wire blob): a file over the wire's 16 MiB bound opened while a client was attached was one unit, past the bound, so a Debug session panicked and a release one dropped it, its client diverging at the next unit and joining again to be sent the whole file in the dump; now the read's answer is recorded as the file's BLAKE3, a client on the session's machine reads the path itself and checks it, a far one is sent it in 1 MiB pieces before the unit and keeps it in its cache.xitdb (XDG_CACHE_HOME/pardes), so a far client that joins after is sent none of it; any other record that long (a reload's text, a paste) goes to every client so; test/daemon.py by_hash: a 17 MiB file under a near and a far client, both agree, neither joins again, the near one reads it itself, the far one is sent 8848 KB of zstd and a far client after it none of its 2 blobs; the slot's own BLAKE3 the brief asked for was built and taken out (a hash a kind's open, 7 instructions a byte on the perf build's CPU, for no reader until a client renders kinds); perf --only medium --reps 10 instructions:u 2,459.25M -> 2,459.36M, --terminal-mib 8 3,928.50M -> 3,928.51M; tui core-test 811/950 (139 skipped), shell-test passes, replicas pass (diverged 0, checked/wrong 0), behaviour-test 269/273 (the four addon ABI tests the base fails), --replay 20 seeds 0 failures, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's; headersweep and headersweep-restored failed once at load 14 and pass alone), test/daemon.py passes
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/fs.zig')
-rw-r--r--src/fs.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fs.zig b/src/fs.zig
index 855beb25..47ee0856 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -726,7 +726,9 @@ fn readFileLimit(gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 {
return pardes.tape.site(.read_file, gpa, readHost, .{ gpa, path_z, limit });
}
-fn readHost(gpa: std.mem.Allocator, path_z: [:0]const u8, limit: usize) ![]u8 {
+/// The disk's file at `path_z`, whole: the session's read, and a replica
+/// client's of a read it was sent by hash (tape.zig `byHash`).
+pub fn readHost(gpa: std.mem.Allocator, path_z: [:0]const u8, limit: usize) ![]u8 {
const fd = libc.open(path_z, .{ .ACCMODE = .RDONLY, .NONBLOCK = true });
if (fd < 0) return switch (libc.errno(fd)) {
.ACCES, .PERM => error.PermissionDenied,