@@ -32,8 +32,8 @@ default interface streams {
3232 /// Read bytes from a stream.
3333 ///
3434 /// This function returns a list of bytes containing the data that was
35- /// read, along with a bool indicating whether the end of the stream
36- /// was reached. The returned list will contain up to `len` bytes; it
35+ /// read, along with a bool which, when true, indicates that the end of the
36+ /// stream was reached. The returned list will contain up to `len` bytes; it
3737 /// may return fewer than requested, but not more.
3838 ///
3939 /// Once a stream has reached the end, subsequent calls to read or
@@ -53,6 +53,16 @@ default interface streams {
5353 len : u64
5454 ) -> result <tuple <list <u8 >, bool >, stream-error >
5555
56+ /// Read bytes from a stream, with blocking.
57+ ///
58+ /// This is similar to `read` , except that it blocks until at least one
59+ /// byte can be read.
60+ blocking-read : func (
61+ this : input-stream ,
62+ /// The maximum number of bytes to read
63+ len : u64
64+ ) -> result <tuple <list <u8 >, bool >, stream-error >
65+
5666 /// Skip bytes from a stream.
5767 ///
5868 /// This is similar to the `read` function, but avoids copying the
@@ -71,6 +81,16 @@ default interface streams {
7181 len : u64 ,
7282 ) -> result <tuple <u64 , bool >, stream-error >
7383
84+ /// Skip bytes from a stream, with blocking.
85+ ///
86+ /// This is similar to `skip` , except that it blocks until at least one
87+ /// byte can be consumed.
88+ blocking-skip : func (
89+ this : input-stream ,
90+ /// The maximum number of bytes to skip.
91+ len : u64 ,
92+ ) -> result <tuple <u64 , bool >, stream-error >
93+
7494 /// Create a `pollable` which will resolve once either the specified stream
7595 /// has bytes available to read or the other end of the stream has been
7696 /// closed.
@@ -109,6 +129,16 @@ default interface streams {
109129 buf : list <u8 >
110130 ) -> result <u64 , stream-error >
111131
132+ /// Write bytes to a stream, with blocking.
133+ ///
134+ /// This is similar to `write` , except that it blocks until at least one
135+ /// byte can be written.
136+ blocking-write : func (
137+ this : output-stream ,
138+ /// Data to write
139+ buf : list <u8 >
140+ ) -> result <u64 , stream-error >
141+
112142 /// Write multiple zero bytes to a stream.
113143 ///
114144 /// This function returns a `u64` indicating the number of zero bytes
@@ -119,6 +149,16 @@ default interface streams {
119149 len : u64
120150 ) -> result <u64 , stream-error >
121151
152+ /// Write multiple zero bytes to a stream, with blocking.
153+ ///
154+ /// This is similar to `write-zeroes` , except that it blocks until at least
155+ /// one byte can be written.
156+ blocking-write-zeroes : func (
157+ this : output-stream ,
158+ /// The number of zero bytes to write
159+ len : u64
160+ ) -> result <u64 , stream-error >
161+
122162 /// Read from one stream and write to another.
123163 ///
124164 /// This function returns the number of bytes transferred; it may be less
@@ -134,6 +174,18 @@ default interface streams {
134174 len : u64 ,
135175 ) -> result <tuple <u64 , bool >, stream-error >
136176
177+ /// Read from one stream and write to another, with blocking.
178+ ///
179+ /// This is similar to `splice` , except that it blocks until at least
180+ /// one byte can be read.
181+ blocking-splice : func (
182+ this : output-stream ,
183+ /// The stream to read from
184+ src : input-stream ,
185+ /// The number of bytes to splice
186+ len : u64 ,
187+ ) -> result <tuple <u64 , bool >, stream-error >
188+
137189 /// Forward the entire contents of an input stream to an output stream.
138190 ///
139191 /// This function repeatedly reads from the input stream and writes
0 commit comments