diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 18:27:14 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 18:49:19 -0300 |
| commit | b7dec1c3da59f23298eaccb2a5185ccf7a50a87a (patch) | |
| tree | e8cfe60427b2aac2db9cdeb6a80d3da95a6b732f /src/Stream.zig | |
| parent | cfaadd978e671c15d9bae96eed72c5ab12718ea1 (diff) | |
| download | pardes-b7dec1c3da59f23298eaccb2a5185ccf7a50a87a.tar.gz pardes-b7dec1c3da59f23298eaccb2a5185ccf7a50a87a.zip | |
Stream: a search run on the loop (a 9P write's Grep or Find, which answers whether it found anything) is a tape site, `search`, its batches what the replay takes, as it takes a worker's (Event.search): its file reads were no site, so a replica of a session a script greps in read no file and joined again (`a syscall that is no tape site, made replaying`, a terminal client live, 2 of 2 before, none after); test/cross_replay.py's session greps and finds again
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Stream.zig')
| -rw-r--r-- | src/Stream.zig | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/Stream.zig b/src/Stream.zig index 665241df..263a6628 100644 --- a/src/Stream.zig +++ b/src/Stream.zig @@ -708,19 +708,28 @@ pub fn runHere(p: *Pardes, gen: u32) void { }; defer job.deinit(); job.waits = false; - var got: Collect = .{ .gpa = p.gpa }; - defer got.batches.deinit(p.gpa); - { - pardes.turn.yield(); - defer pardes.turn.back(); - work(std.Io.Threaded.global_single_threaded.io(), job, &got, Collect.take); - } - for (got.batches.items) |*b| { + // Its reads a site of the tape's (a 9P write's Grep or Find runs here): + // a replica takes the batches the session got, as it takes a worker's + // (Event.search), and reads no file. + const batches = pardes.tape.site(.search, p.gpa, searchHere, .{ p.gpa, job }); + defer p.gpa.free(batches); + for (batches) |*b| { receive(p, b); b.deinit(p.gpa); } } +/// The whole search, its batches gpa's. +fn searchHere(gpa: std.mem.Allocator, job: *Job) []Batch { + var got: Collect = .{ .gpa = gpa }; + work(std.Io.Threaded.global_single_threaded.io(), job, &got, Collect.take); + return got.batches.toOwnedSlice(gpa) catch { + for (got.batches.items) |b| b.deinit(gpa); + got.batches.deinit(gpa); + return &.{}; + }; +} + const Collect = struct { gpa: std.mem.Allocator, batches: std.ArrayList(Batch) = .empty, |
