You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Posix's recv function can have a MSG_PEEK flag, which tells it to read data without consuming it, so that subsequent calls to recv read it again. Is this useful to have in I/O Streams?
We can implement this efficiently for some devices, such as sockets (using recv), but not others, such as pipes on POSIX, though we could always emulated it by adding our own buffer.
On the other hand, if we don't have a peek, it would simplify the API, and userspace can always implement its own peek functionality by using its own buffer, though this may be less efficient for devices that already do support peek.
The text was updated successfully, but these errors were encountered:
wasi-io is being subsumed by wit streams, though we can also ask whether wit streams should support a peek operation.
The wit stream model is one where the user provides a buffer and registers interest, and then data asynchronously arrives in the buffer. A peek operation would work when the data is being copied in from a second buffer, but in cases where the host manages to write the data straight into the user's buffer, peek would require the host to keep an extra copy of the data.
So for the moment, it doesn't seem like peek will make sense. And going forward, we can certainly re-open this if other considerations emerge.
Posix's
recv
function can have aMSG_PEEK
flag, which tells it to read data without consuming it, so that subsequent calls torecv
read it again. Is this useful to have in I/O Streams?We can implement this efficiently for some devices, such as sockets (using
recv
), but not others, such as pipes on POSIX, though we could always emulated it by adding our own buffer.On the other hand, if we don't have a peek, it would simplify the API, and userspace can always implement its own peek functionality by using its own buffer, though this may be less efficient for devices that already do support peek.
The text was updated successfully, but these errors were encountered: