Stream: wasi

Topic: Suggest to support `seek` in `wasi:io`


view this post on Zulip Mossaka (Joe) (Jan 03 2024 at 02:23):

Hi there,

this comes up ƒrom today's Go Subgroup meeting where @Damian Gryski was discussing some of the challenges in implementing wasip2 in TinyGo. The question is how to implement seek in wasip2. While wasi:io provides a skip function that allow you to advance the stream's current position by an offset, but it doesn't allow bacward movement or movement relative to the end of the stream that seek offers.

One possible implemention would be replacing skip with seek that takes an signed inteter as the offset, allowing it to go forward or backward. This might be challenging since not all streams support seeking. e.g. network data. What do you think?

FYI @Pat Hickey @Dan Gohman @Randy Reddig @Bailey Hayes

view this post on Zulip Dan Gohman (Jan 03 2024 at 04:53):

The way seek is expected to be implemented is by dropping the old stream, and creating a new stream at the new offset, by calling read-via-stream or write-via-stream on the descriptor.

view this post on Zulip Bailey Hayes (Jan 03 2024 at 20:04):

^ That sounds just like the approach @Damian Gryski landed on


Last updated: Nov 22 2024 at 17:03 UTC