Skip to content

fix(wasi): enable all WasiFiles to be pollable#3913

Merged
pchickey merged 1 commit intobytecodealliance:mainfrom
npmccallum:wasi
Mar 10, 2022
Merged

fix(wasi): enable all WasiFiles to be pollable#3913
pchickey merged 1 commit intobytecodealliance:mainfrom
npmccallum:wasi

Conversation

@npmccallum
Copy link
Member

Currently, the use of the downcast method means that you have to use one
of the hard-coded types. But Enarx needs to define its own WasiFile
implementations. This works fine, except the resulting files cannot be
used in poll because they aren't part of the hard-coded list.

Replace this with an accessor method for the pollable type in
WasiFile. Because we provide a default implementation of the method
and manually implement it on all the hard-coded types, this is backwards
compatible.

Signed-off-by: Nathaniel McCallum nathaniel@profian.com

@github-actions github-actions bot added the wasi Issues pertaining to WASI label Mar 10, 2022
@github-actions
Copy link

Subscribe to Label Action

cc @kubkon

Details This issue or pull request has been labeled: "wasi"

Thus the following users have been cc'd because of the following labels:

  • kubkon: wasi

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@npmccallum npmccallum force-pushed the wasi branch 3 times, most recently from f65858b to 3de52f1 Compare March 10, 2022 15:29
Currently, the use of the downcast method means that you have to use one
of the hard-coded types. But Enarx needs to define its own `WasiFile`
implementations. This works fine, except the resulting files cannot be
used in poll because they aren't part of the hard-coded list.

Replace this with an accessor method for the pollable type in
`WasiFile`. Because we provide a default implementation of the method
and manually implement it on all the hard-coded types, this is backwards
compatible.

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great refactor, I cannot recall why this was written in such a backwards way but I assume that some prior refactor made this possible

@pchickey pchickey merged commit 0df4e96 into bytecodealliance:main Mar 10, 2022
npmccallum added a commit to npmccallum/wasmtime that referenced this pull request Mar 10, 2022
Currently, the use of the downcast method means that you have to use one
of the hard-coded types. But Enarx needs to define its own `WasiFile`
implementations. This works fine, except the resulting files cannot be
used in poll because they aren't part of the hard-coded list.

Replace this with an accessor method for the pollable type in
`WasiFile`. Because we provide a default implementation of the method
and manually implement it on all the hard-coded types, this is backwards
compatible.

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants