diff options
Diffstat (limited to 'src/replica.zig')
| -rw-r--r-- | src/replica.zig | 16 |
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); } |
