diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 17:54:43 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 20:25:56 -0300 |
| commit | 494aeadc46212766b3d7869a2ed8b811ac490ffa (patch) | |
| tree | b3a00bf03f741415c1dd39a5eb7ba4f070152d14 /src/tape.zig | |
| parent | 58c230e73ab64e7b015a95462bde554c6b25df79 (diff) | |
| download | pardes-494aeadc46212766b3d7869a2ed8b811ac490ffa.tar.gz pardes-494aeadc46212766b3d7869a2ed8b811ac490ffa.zip | |
replica: an input's time is its client's: it is sent stamped with the client's guess of the session's clocks (wire 18's `stamp`), the guess its speculation records, and the authority's step reads that, not its own clocks (within a second of them, else its own), so a step's clock read never mispredicts: an edit's second across a turn, a message's millisecond (Ctrl-W's, a jump's) were each a rollback (fixer 1: 4 seen in 2 minutes), and every reapply of one now reads the same time
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tape.zig')
| -rw-r--r-- | src/tape.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tape.zig b/src/tape.zig index 12f7fe3d..4759d598 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -257,6 +257,11 @@ pub const Tape = struct { /// (src/replica.zig): its clock reads (a message's stamp, a file's /// mtime) answer this instead of the clocks here. guess: ?Guess = null, + /// The same guess, as the client sent it with its input, while the + /// authority steps that input: the step's clock reads are the input's + /// time, so the guess a speculation recorded is what the authority + /// records (a message's millisecond, an edit's second never miss). + stamp: ?Guess = null, fn record(t: *Tape, kind: Kind, comptime T: type, v: *const T) void { t.scratch.clearRetainingCapacity(); @@ -914,7 +919,7 @@ fn call(comptime s: Site, a: ?std.mem.Allocator, comptime f: anytype, args: anyt t.poisoned_by = @tagName(s); return poisonOf(R); } - if (comptime s == .clock or s == .mtime) if (t.speculating) if (t.guess) |g| { + if (comptime s == .clock or s == .mtime) if (if (t.speculating) t.guess else t.stamp) |g| { const r = guessed(R, g); t.record(.host, u16, &id); t.record(.ret, R, &r); |
