summaryrefslogtreecommitdiff
path: root/src/rollback.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/rollback.zig')
-rw-r--r--src/rollback.zig11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rollback.zig b/src/rollback.zig
index 9c4f6c05..cc10d2cc 100644
--- a/src/rollback.zig
+++ b/src/rollback.zig
@@ -221,7 +221,9 @@ pub const Copy = struct {
return a.addr == b.addr and a.ty == b.ty;
}
};
- pub const Error = Allocator.Error;
+ /// Queued: the core holds effects or inputs not drained yet, which no
+ /// copy is taken over (the replica's input waits for the authority).
+ pub const Error = Allocator.Error || error{Queued};
pub fn deinit(c: *Copy) void {
c.regions.deinit(c.meta);
@@ -244,14 +246,15 @@ pub const Copy = struct {
/// it held stays where it is until the copy is put back or let go.
pub fn take(c: *Copy, e: *Epoch, p: *const Pardes) Error!void {
std.debug.assert(!c.held);
+ // A step drains these before it ends, and a copy is taken between
+ // steps; an input of a host's without one (a view closed) may leave
+ // some until it is drained.
+ if (p.effects_len != 0 or p.in_len != 0) return error.Queued;
c.regions.clearRetainingCapacity();
c.bytes.clearRetainingCapacity();
c.seen.clearRetainingCapacity();
c.pins.clearRetainingCapacity();
c.epoch = e;
- // A step drains these before it ends: between steps they hold
- // nothing, and a copy is taken between steps.
- std.debug.assert(p.effects_len == 0 and p.in_len == 0);
if (c.epoch.?.owns(@intFromPtr(p)) == null) @panic("rollback: the core is not its epoch's");
try c.object(Pardes, p);
e.begin();