Repository navigation
fs: add io_uring-style prep functions to File - #684
Conversation
Fill an ev op with the file's handle and routing state without submitting it: prepRead, prepWrite, prepReadStreaming, prepWriteStreaming, prepStat, prepSync. The op is inert until handed to the loop, so callers can build batches of typed ops and drive them through a CompletionQueue or an ev.Group without constructing ev structs by hand; the streaming preps carry the file's pollable routing, which a hand-rolled init would silently miss. The blocking methods are refactored to sit on top of the prep functions (and the slice conveniences on top of the Buf variants), so each operation has a single construction point.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 4 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughWalkthrough
ChangesFile operation preparation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR adds non-submitting file-operation preparation helpers and routes existing blocking methods through them; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Streaming I/O on regular files is not supported on Windows (the fallback writev fails with INVALID_PARAMETER); the io.zig streaming-file tests are skipped there for the same reason. The prep itself is platform-independent and stays checked everywhere.
First slice of the "make the ev layer comfortable" direction: io_uring-style prep functions on
Filethat fill an ev op in place without submitting it, so users hold and submit ops without ever constructing ev structs by hand:Added:
prepRead,prepWrite,prepReadStreaming,prepWriteStreaming,prepStat,prepSync.Design points:
waitForIo,CompletionQueue.submit,ev.Group.add), so it is safe to move until then; no result-location hazards.pollablerouting (event loop vs thread pool), which a hand-rolledev.FileReadStreaming.initwould silently miss.Buf-taking tier only. The slice conveniences (read,readVec, ...) keep their iovec storage on the blocking call's frame, which cannot outlive a prep, so they stay blocking-only and now route throughreadBuf/writeBuf.Tests: a 4-way concurrent positional read batch driven through a CompletionQueue with per-op result and buffer verification, and a streaming prep +
waitForIoround-trip that checks thepollablerouting is carried over.Scope:
Fileonly for now;Dirand socket preps can follow the same pattern.