summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 19:53:07 -0300
committerGabriel Schneider <[email protected]>2026-11-05 20:49:41 -0300
commit0d07182abfa2cb02c5351231af2f1e1a156a59af (patch)
treecb62d307bda99fa3634749d86aa0092c6f42be5b /src/File.zig
parent9e504559356ed985999d8625947d9b08ad582792 (diff)
downloadpardes-0d07182abfa2cb02c5351231af2f1e1a156a59af.tar.gz
pardes-0d07182abfa2cb02c5351231af2f1e1a156a59af.zip
digest: a blob of 4 KiB and up (a file's text, a register's text, a file's rows, an undo entry's bytes) is taken as its length, never its bytes, a text's revision saying what it holds, where it was hashed once and kept as a word by its address (walk.zig's blob words, from when no text was written in place): since the journal a session's edit writes its text in place, and since the change before a replica's does too, so the word went at every edit and the next unit's digest hashed the whole text again, 100 MB of it in a big file, on the session's step and the replica's; the words go with what kept them (walk.forget, wordOf, forgetAll, unhashed, makeWords, the bench's blob_words_on, memory.freeRaw's and unpin's forgets, File.edit's and grow's), and so does the join's hashing thread (replica.Peers' held, texts, hasher and rounds, joins, hashTexts, unhashedDone, the `hashed` note), which made the words of the texts a session never digested before a join's digest took them, its pins with it: a client is joined at the boundary its connection comes at; the semantics change, so the wire's version is 20 (a client of the build before is refused at its hello, as any other build's, and test/daemon.py's own hello says 20); a blob under 4 KiB is hashed whole as before, so a small text's bytes stay in the digest, and the replicas harness (test/replicas.zig) compares every file's text byte for byte at quiescence beside the digest; tests: walk.zig's 'a blob is hashed once and folded in as a word; one written in place is not its word, which a Debug build checks; a freed one's word goes' becomes 'a blob of 4 KiB and up is digested by its length, what it holds told by its keeper's revision; a smaller one by its bytes'
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/File.zig b/src/File.zig
index 8e5c0101..05d02673 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -961,7 +961,7 @@ fn edit(p: *Pardes, f: *State, off: usize, len: usize, bytes_in: []const u8, who
undo_gone = f.history.journal.swap(p.gpa, old, old_len, new_len);
} else {
// Raw: `free` overwrites a safe build's freed memory, a whole
- // file's worth; and its digest word goes (src/walk.zig).
+ // file's worth.
pardes.memory.freeRaw(p.gpa, old);
}
} else {
@@ -972,8 +972,6 @@ fn edit(p: *Pardes, f: *State, off: usize, len: usize, bytes_in: []const u8, who
@memcpy(buffer[off..][0..bytes.len], bytes);
f.content = buffer[0..new_len];
f.cap = buffer.len;
- // Written in place: a word a digest kept for it is no longer its.
- pardes.walk.forget(@intFromPtr(buffer.ptr));
}
f.revision +%= 1;
f.splice = .{ .revision = f.revision, .head = span.head, .tail = span.tail, .old_len = old_len };
@@ -1034,7 +1032,6 @@ fn grow(gpa: std.mem.Allocator, f: *State, n: usize) !void {
if (n <= room.len) return;
const want = n + @max(n / 8, 4096);
if (room.len > 0) if (gpa.remap(room, want)) |grown| {
- pardes.walk.forget(@intFromPtr(room.ptr));
f.content = grown[0..f.content.len];
f.cap = grown.len;
return;