-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement Resource<T>
-> ResourceAny
conversion
#7688
feat: implement Resource<T>
-> ResourceAny
conversion
#7688
Conversation
6269937
to
ae2d9c7
Compare
I think I might have missed something in this by accident perhaps. I don't think that this is the direction things should go in, for example The title of this PR though, allowing host creation of guest resources, is not something Wasmtime can enable. Just as guests can't create host-defined resources without asking the host to do so the other way around is the same. The host can't conjure a guest resource out of thin air, it must originate in the guest. Given that I fear I might have missed some motivation/use case when talking about this, could you perhaps clarify? |
Here's a more concrete example of the use case: Assume the following WIT:
And a component exporting the The intention is to call The host, however, can already push a |
Another way to look at this would be the following:
Perhaps an even more generic view on this could be allowing arbitrary This all really boils down to being able to pass the resource index to a component in cases where the resource type is not known at compilation time |
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasi", "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
ae2d9c7
to
32ef4ea
Compare
Resource<T>
-> ResourceAny
conversion
32ef4ea
to
d1c0142
Compare
Small update: I found a way to obtain the
I will reach-out offline |
7e9054f
to
a212201
Compare
@alexcrichton , as discussed, I introduced a |
fa9fedf
to
e6c6923
Compare
e6c6923
to
7258e70
Compare
7258e70
to
ab6d971
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this! A few comments which I'm happy to defer to later, but for the implementation of LinkerInstance::resource
I think it'd be good to continue to rely on the insert
helper. I wouldn't worry too much about the interaction of bumping the resource counter if an error is returned.
ab6d971
to
23d5411
Compare
Any progress? This is blocker for us |
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
06f11f2
to
3af16f3
Compare
Hey @sehz, There was a doc CI failure:
Which, I believe, is now fixed. I've rebased and added Please note that I'm generally out of office until Monday, the 8th of January, but I may be able to address small things like this doc CI failure in the meantime |
prtest:full Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
3af16f3
to
17923ff
Compare
Closes #7676
Follow-up on #7680
This feature requires changes in the resource table to allow specifying theResourceType
associated with the resource stored (since assumption that it's always equal toResourceType::host::<T>()
is no longer valid)Add support for
Resource<T>
->ResourceAny
conversion to allow invoking component functions without bindings generated at compile-time.