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
It would be nice if we could break up spin-test-virt into several different components which could be swapped out or reused by other projects. One of the most central pieces of spin-test-virt is wasi:io which powers a lot of different interfaces in wasi (e.g., wasi:filesystem and wasi:http).
The approach one would imagine to take would be to create a component with the following wit:
packagefermyon:wasi-io-virt;/// Configurable virtualized implementation of `wasi:io`.worldio {
exportwasi:io/streams@0.2.0;
exportwasi:io/error@0.2.0;
exportwasi:io/poll@0.2.0;
importwasi:io/streams@0.2.0;
importwasi:io/error@0.2.0;
importwasi:io/poll@0.2.0;
exportconfig;
}
interfaceconfig {
usewasi:io/poll@0.2.0.{pollable};
/// Create a new pollable.new-poll:func(config:pollable-config) ->pollable;
variantpollable-config {
/// The pollable comes from the host.host(pollable),
/// The pollable is virtualized.virtualized
}
// Imagine similar interfaces for `input-stream` and `output-stream`
}
This component both imports and exports wasi:io as well as an additional config interface. The component can virtualize all io interfaces in terms of the imported interfaces (either be implementing them within the component or by delegating to the imported interfaces. The config interface allows users of the component to create new io resources that are either virtualized or backed by some imported resource.
This, however, won't work as imagined as the pollable used in config refers to the exported pollable resource where we would need for it to refer to the imported pollable resource. Unfortunately WIT doesn't allow you to refer to imported items in an exported interface. While this is possible in the component model, it is not possible in WIT today.
The text was updated successfully, but these errors were encountered:
It would be nice if we could break up
spin-test-virt
into several different components which could be swapped out or reused by other projects. One of the most central pieces ofspin-test-virt
iswasi:io
which powers a lot of different interfaces in wasi (e.g.,wasi:filesystem
andwasi:http
).The approach one would imagine to take would be to create a component with the following wit:
This component both imports and exports
wasi:io
as well as an additionalconfig
interface. The component can virtualize all io interfaces in terms of the imported interfaces (either be implementing them within the component or by delegating to the imported interfaces. Theconfig
interface allows users of the component to create newio
resources that are either virtualized or backed by some imported resource.This, however, won't work as imagined as the
pollable
used inconfig
refers to the exportedpollable
resource where we would need for it to refer to the importedpollable
resource. Unfortunately WIT doesn't allow you to refer to imported items in an exported interface. While this is possible in the component model, it is not possible in WIT today.The text was updated successfully, but these errors were encountered: