summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:51:09 -0300
committerGabriel Schneider <[email protected]>2026-11-05 09:54:56 -0300
commit1b311fe309aff2b6b82e4b9e3d865dd8b3cd2077 (patch)
tree8c7103d3141bd1f27587a9fb720cf17df13f90ac /src/replica.zig
parente0e54fd0820696d5d1fdd937ae17e9dd57556472 (diff)
downloadpardes-1b311fe309aff2b6b82e4b9e3d865dd8b3cd2077.tar.gz
pardes-1b311fe309aff2b6b82e4b9e3d865dd8b3cd2077.zip
tape: check takes a digest record's payload and is pub, so checkDigest goes, and taken and clearTaken go for the tape's buffer itself, as replica.zig reads the tape's other fields
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/replica.zig b/src/replica.zig
index 4a93ec3d..5c46f5c2 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -207,8 +207,8 @@ pub const Authority = struct {
a.out.clearRetainingCapacity();
try a.out.appendNTimes(a.gpa, 0, unit_head);
unitHeader(a.out.items, origin, seq);
- try a.out.appendSlice(a.gpa, tape.taken(&a.t));
- tape.clearTaken(&a.t);
+ try a.out.appendSlice(a.gpa, a.t.buf.items);
+ a.t.buf.clearRetainingCapacity();
return a.out.items;
}
@@ -799,7 +799,7 @@ pub const Replica = struct {
// derived field's) shows here, at the input that did it,
// not at some later unit replayed.
if (lastDigest(u.tape)) |d| {
- tape.checkDigest(&r.t, d);
+ r.t.check(d);
if (r.t.diverged) |why| {
trace(r.gpa, "replica {d}: its input {d} came to another state than the session's: {s}\n", .{ r.id, u.seq, why }, &.{u.tape});
return r.fail(why);
@@ -979,8 +979,8 @@ pub const Replica = struct {
}
r.stats.speculated += 1;
if (r.stats.samples) r.stats.spec_ns.append(r.gpa, dt) catch {};
- p.spec = r.gpa.dupe(u8, tape.taken(&r.t)) catch return false;
- tape.clearTaken(&r.t);
+ p.spec = r.gpa.dupe(u8, r.t.buf.items) catch return false;
+ r.t.buf.clearRetainingCapacity();
r.applied += 1;
return true;
}
@@ -1779,14 +1779,14 @@ pub const Peers = struct {
/// What was recorded since the last unit, to every client as one, its
/// digest at its end.
fn unit(ps: *Peers, origin: u16, seq: u32) void {
- if (tape.taken(&ps.t).len == 0) return;
+ if (ps.t.buf.items.len == 0) return;
tape.recordDigest(&ps.t);
- const bytes = tape.taken(&ps.t);
+ const bytes = ps.t.buf.items;
unitHeader(&ps.head, origin, seq);
trace(ps.gpa, "session: unit {d}/{d}, {d} bytes, to {d} clients:\n", .{ origin, seq, bytes.len, ps.count() }, &.{bytes});
const head = wire.header(@backingInt(wire.ServerTag.unit), unit_head + bytes.len);
for (ps.list) |slot| if (slot) |peer| peer.send(&.{ &head, &ps.head, bytes });
- tape.clearTaken(&ps.t);
+ ps.t.buf.clearRetainingCapacity();
// The sizes its steps gave terminals, now: the next flush says so.
if (ps.t.core) |core| terminal.resizeDeferred(core);
}