Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make splice atomic #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ let _ = this.check-write(); // eliding error handling
<code>check-write</code> permitted length and the <code>len</code> provided to <code>splice</code></li>
<li>calling <code>write</code> on the <a href="#output_stream"><code>output-stream</code></a> with that read data.</li>
</ol>
<p>This function behaves as-if these steps are performed atomically.
I.e. if the read (in step 2) succeeds, but the write (in step 3) fails,
future reads will first read from the buffer alread retrieved in step 2.</p>
<p>Any error reported by the call to <code>check-write</code>, <code>read</code>, or
<code>write</code> ends the splice and reports that error.</p>
<p>This function returns the number of bytes transferred; it may be less
Expand Down
4 changes: 4 additions & 0 deletions wit/streams.wit
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ interface streams {
/// `check-write` permitted length and the `len` provided to `splice`
/// 3. calling `write` on the `output-stream` with that read data.
///
/// This function behaves as-if these steps are performed atomically.
/// I.e. if the read (in step 2) succeeds, but the write (in step 3) fails,
/// future reads will first read from the buffer alread retrieved in step 2.
///
/// Any error reported by the call to `check-write`, `read`, or
/// `write` ends the splice and reports that error.
///
Expand Down