summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/tape.zig b/src/tape.zig
index c2ddbb9d..b30096f5 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -167,6 +167,9 @@ pub const Tape = struct {
/// output carries one, at the pty's read rate), not one a field; what
/// differs is then not named.
whole_digest: bool = false,
+ /// A digest only when asked (`recordDigest`): the replica stream's,
+ /// one a unit, not one after each of its inputs.
+ unit_digests: bool = false,
/// A replica client's guess of the session's clocks for a speculation
/// (src/replica.zig): its clock reads (a message's stamp, a file's
/// mtime) answer this instead of the clocks here.
@@ -275,7 +278,7 @@ pub const Tape = struct {
t.wrap(core);
};
t.record(.done, void, &{});
- if ((t.depth == 0 or t.every) and !t.no_digest) if (t.core) |core| {
+ if ((t.depth == 0 or t.every) and !t.no_digest and !t.unit_digests) if (t.core) |core| {
var parts: Parts = undefined;
const whole = [1]u64{digestOf(core)};
const d: []const u64 = if (t.whole_digest) &whole else digestParts(core, &parts);
@@ -802,6 +805,16 @@ fn guessed(comptime R: type, g: Guess) R {
@compileError("tape: no guess of a clock read as " ++ @typeName(R));
}
+/// The session's digest recorded now (a unit's end: the replica stream's
+/// one, `unit_digests`).
+pub fn recordDigest(t: *Tape) void {
+ const core = t.core orelse return;
+ var parts: Parts = undefined;
+ const whole = [1]u64{digestOf(core)};
+ const d: []const u64 = if (t.whole_digest) &whole else digestParts(core, &parts);
+ t.record(.digest, []const u64, &d);
+}
+
/// A core made outside the tape (a replica client's, from a dump) is the
/// one it replays into.
pub fn adoptCore(t: *Tape, p: *Pardes) void {