Stream: git-wasmtime

Topic: wasmtime / PR #8053 wasmtime-wasi: introduce WasiP1Ctx


view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:00):

pchickey edited PR #8053.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:05):

pchickey has marked PR #8053 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:05):

pchickey requested fitzgen for a review on PR #8053.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:05):

pchickey requested wasmtime-core-reviewers for a review on PR #8053.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:12):

pchickey requested elliottt for a review on PR #8053.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:12):

pchickey edited PR #8053:

This PR adds wasmtime_wasi::WasiP1Ctx, which is a WasiCtx for just using WASI P1 (and P0).

This simplifies user experience for users migrating from wasi-common's P1 support - it means they dont have to know about the View traits or the WasiPreview1Adapter.

The p1/p0 add_to_linker functions now take a closure that is the lens for the T in Store<T>, to be consistent with wasi-common and in general what wasmtime::Linker users expect.

WasiCtxBuilder now has a convenient function build_p1(&mut self) -> WasiP1Ctx that can be used in the place of build(&mut self) -> WasiCtx for users targeting a P1 embedding.

This PR also adds two trivial methods to WasiCtxBuilder to reflect ones that existed in wasi-common;s: inherit_env and inherit_args.

Finally, this PR adds AsyncStdinStream and AsyncStdoutStream as wrappers on AsyncReadStream and AsyncWriteStream to provide implementations of StdinStream and StdoutStream. (This could be separated into a totally different PR, but it doesnt seem worth the e-paperwork overhead to bother.) These provide parity with the wasi-common affordances for piping stdio to/from files, which happen to be used in the c-api.

<!--
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 (Mar 08 2024 at 00:13):

pchickey edited PR #8053:

This PR adds wasmtime_wasi::WasiP1Ctx, which is a WasiCtx for just using WASI P1 (and P0).

This simplifies user experience for users migrating from wasi-common's P1 support - it means they dont have to know about the *View traits or the WasiPreview1Adapter, which are just implementation details to a P1 embedder.

The p1/p0 add_to_linker functions now take a closure that is the lens for the T in Store<T>, to be consistent with wasi-common and in general what wasmtime::Linker users expect.

WasiCtxBuilder now has a convenient function build_p1(&mut self) -> WasiP1Ctx that can be used in the place of build(&mut self) -> WasiCtx for users targeting a P1 embedding.

This PR also adds two trivial methods to WasiCtxBuilder to reflect ones that existed in wasi-common;s: inherit_env and inherit_args.

Finally, this PR adds AsyncStdinStream and AsyncStdoutStream as wrappers on AsyncReadStream and AsyncWriteStream to provide implementations of StdinStream and StdoutStream. (This could be separated into a totally different PR, but it doesnt seem worth the e-paperwork overhead to bother.) These provide parity with the wasi-common affordances for piping stdio to/from files, which happen to be used in the c-api.

<!--
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 (Mar 08 2024 at 00:13):

pchickey edited PR #8053:

This PR adds wasmtime_wasi::WasiP1Ctx, which is a WasiCtx for just using WASI P1 (and P0).

This simplifies user experience for users migrating from wasi-common's P1 support - it means they don't have to know about the *View traits or the WasiPreview1Adapter, which are just implementation details to a P1 embedder.

The p1/p0 add_to_linker functions now take a closure that is the lens for the T in Store<T>, to be consistent with wasi-common and in general what wasmtime::Linker users expect.

WasiCtxBuilder now has a convenient function build_p1(&mut self) -> WasiP1Ctx that can be used in the place of build(&mut self) -> WasiCtx for users targeting a P1 embedding.

This PR also adds two trivial methods to WasiCtxBuilder to reflect ones that existed in wasi-common;s: inherit_env and inherit_args.

Finally, this PR adds AsyncStdinStream and AsyncStdoutStream as wrappers on AsyncReadStream and AsyncWriteStream to provide implementations of StdinStream and StdoutStream. (This could be separated into a totally different PR, but it doesnt seem worth the e-paperwork overhead to bother.) These provide parity with the wasi-common affordances for piping stdio to/from files, which happen to be used in the c-api.

<!--
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 (Mar 08 2024 at 00:14):

pchickey edited PR #8053:

This PR adds wasmtime_wasi::WasiP1Ctx, which is a WasiCtx for just using WASI P1 (and P0).

This simplifies user experience for users migrating from wasi-common's P1 support - it means they don't have to know about the *View traits or the WasiPreview1Adapter, which are just implementation details to a P1 embedder.

The p1/p0 add_to_linker_{a?}sync functions now take a closure that is the lens for the T in Store<T>, to be consistent with wasi-common and in general what wasmtime::Linker users expect.

WasiCtxBuilder now has a convenient function build_p1(&mut self) -> WasiP1Ctx that can be used in the place of build(&mut self) -> WasiCtx for users targeting a P1 embedding.

This PR also adds two trivial methods to WasiCtxBuilder to reflect ones that existed in wasi-common;s: inherit_env and inherit_args.

Finally, this PR adds AsyncStdinStream and AsyncStdoutStream as wrappers on AsyncReadStream and AsyncWriteStream to provide implementations of StdinStream and StdoutStream. (This could be separated into a totally different PR, but it doesnt seem worth the e-paperwork overhead to bother.) These provide parity with the wasi-common affordances for piping stdio to/from files, which happen to be used in the c-api.

The top-level tests and examples that were using wasi-common are updated to use wasmtime-wasi::WasiP1Ctx.

<!--
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 (Mar 08 2024 at 00:17):

elliottt submitted PR review:

:tada:

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 00:17):

pchickey commented on PR #8053:

This PR should be backported to the release-19.0.0 branch

view this post on Zulip Wasmtime GitHub notifications bot (Mar 08 2024 at 01:06):

elliottt merged PR #8053.


Last updated: Nov 22 2024 at 16:03 UTC