summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index f5d6f375..af284e84 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -51,6 +51,9 @@ pub const Host = struct {
/// Start the streaming search of this generation on a worker
/// (pardes.Stream.start); absent, it runs on the loop.
search: ?*const fn (ctx: ?*anyopaque, gen: u32) void = null,
+ /// Carry the dump of handover `seq` to another window on a worker
+ /// (Handover.start), which answers through the inbox's `handed`.
+ hand_over: ?*const fn (ctx: ?*anyopaque, seq: u32, bytes: []const u8) void = null,
};
};
@@ -135,6 +138,9 @@ pub const Inbox = struct {
/// A streaming search's rows (pardes.Stream), of whatever generation:
/// the core drops a stale one.
search: pardes.Stream.Batch,
+ /// How a handover went (Handover.zig): `words` is where it went, or
+ /// why it did not; gpa-owned.
+ handed: struct { seq: u32, ok: bool, words: []u8 },
files_changed,
fs_ready,
@@ -148,6 +154,7 @@ pub const Inbox = struct {
response.deinit(gpa);
},
.search => |b| b.deinit(gpa),
+ .handed => |h| gpa.free(h.words),
.eof, .files_changed, .fs_ready => {},
}
}
@@ -432,6 +439,13 @@ pub const Inbox = struct {
q.push(.{ .pipe = response });
}
+ /// A handover's end (Handover.Job.post).
+ pub fn pushHanded(ctx: ?*anyopaque, seq: u32, ok: bool, words: []const u8) void {
+ const q: *Inbox = @ptrCast(@alignCast(ctx.?));
+ const copy = q.gpa.dupe(u8, words) catch return;
+ q.push(.{ .handed = .{ .seq = seq, .ok = ok, .words = copy } });
+ }
+
/// A streaming search's batch (pardes.Stream.start's sink). Never
/// dropped for want of room, as output is not: the worker waits for
/// room, a wait its cancel ends (false: it stops).