Stream: git-wasmtime

Topic: wasmtime / PR #7130 Refactor how `subscribe` works in WASI


view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:08):

alexcrichton opened PR #7130 from alexcrichton:refactor-subscribe to bytecodealliance:main:

This commit refactors how the Pollable resource is created in WASI. Previously this was created manually via two variants of a Pollable enum but this was somewhat error prone for a few reasons:

This commit replaces the previous API with a single subscribe function which takes a Resource<T> and returns a Resource<Pollable>. The T type must implement a new trait, Subscribe, which indicates the asynchronous readiness check. This readiness check additionally returns () so it's no longer possible to accidentally return errors (or trap).

This namely required refactoring the HostOutputStream trait and implementations. The trait itself now has a check_write method corresponding to to the same WASI function. The old write_ready function is now a convenience helper combo between ready and check_write. Concrete implementations are refactored to store errors discovered during ready to get communicated through check-write later on.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:08):

alexcrichton requested pchickey for a review on PR #7130.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:08):

alexcrichton requested wasmtime-core-reviewers for a review on PR #7130.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 22:56):

pchickey requested elliottt for a review on PR #7130.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 23:01):

pchickey submitted PR review:

This is a really nice improvement given all the safety changes. Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 01:50):

alexcrichton merged PR #7130.


Last updated: Dec 23 2024 at 13:07 UTC