summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/replica.zig34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/replica.zig b/src/replica.zig
index e483693a..439f71a2 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -537,9 +537,8 @@ pub const Stats = struct {
};
/// `terminal`: its speculation read a terminal or moved one's view (or a
-/// terminal had the keyboard), so what it did depends on the emulator, and
-/// `digest` is the state it ended on: the same records are not enough.
-const Pending = struct { seq: u32, msg: []u8, spec: ?[]u8 = null, sent_ns: u64 = 0, terminal: bool = false, digest: u64 = 0, guess: ?tape.Guess = null };
+/// terminal had the keyboard), so what it did depends on the emulator.
+const Pending = struct { seq: u32, msg: []u8, spec: ?[]u8 = null, sent_ns: u64 = 0, terminal: bool = false, guess: ?tape.Guess = null };
/// A terminal's view as the authority's was once `after` of the units
/// since the copy were taken (`Replica.since`): a delta's comes after the
@@ -757,7 +756,7 @@ pub const Replica = struct {
const was = Stepping.begin(&r.t, &r.epoch);
defer was.end();
if (u.origin == r.id and r.pending.items.len > 0 and r.pending.items[0].seq == u.seq and r.applied > 0 and
- tape.sameRecords(r.pending.items[0].spec.?, u.tape) and endsOn(r.pending.items[0], u.tape))
+ tape.sameRecords(r.pending.items[0].spec.?, u.tape))
{
r.stats.fast += 1;
if (r.pending.items[0].terminal and r.applied > 1) {
@@ -950,11 +949,9 @@ pub const Replica = struct {
c.update(in.event);
c.step();
p.terminal = r.t.screen_state and (keyboard or r.t.touched);
- // A delta the authority's step read and this did not (one held
- // back at the bound in flight) would leave the same records and
- // another state: its digest says (no emulator's in it, only what
- // pardes made of one).
- if (p.terminal) p.digest = tape.digestOf(c);
+ // No digest is taken here: a blob born under the copy and digested
+ // keeps its word past the epoch's free of it (src/walk.zig), and a
+ // later blob at that address read as it.
const clean = tape.endSpeculation(&r.t);
const dt = nowNs() - t0;
// Where a blob was written, should one be: the input that did.
@@ -1169,25 +1166,6 @@ pub const Replica = struct {
}
};
-/// Whether a unit ends where speculation `p` did: always, but for one over
-/// a terminal, whose digest must be the unit's last (a word, the stream's;
-/// a unit of a traced session, a field a word, is taken on its records).
-fn endsOn(p: Pending, unit: []const u8) bool {
- if (!p.terminal) return true;
- var r: walk.Reader = .{ .bytes = unit };
- var last: ?[]const u8 = null;
- while (true) {
- const head = r.take(5) catch break;
- const payload = r.take(std.mem.bytesToValue(u32, head[1..5])) catch break;
- if (head[0] == tape.digest_kind) last = payload;
- }
- var in: walk.Reader = .{ .bytes = last orelse return true };
- var room: [64]u8 = undefined;
- var fixed: std.heap.FixedBufferAllocator = .init(&room);
- const words = walk.decode([]const u64, &in, fixed.allocator()) catch return true;
- return words.len != 1 or words[0] == p.digest;
-}
-
/// The bytes of a unit's last digest record: the state it ended on; null
/// for one that says what the host wrote or which host it is (a replica's
/// core takes those only by replaying the unit).