Skip to content
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

Add Engine::detect_precompiled_file() #6937

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Conversation

acfoltzer
Copy link
Contributor

This is handy for users of deserialize_file() to determine which version to call.

This is handy for users of `deserialize_file()` to determine which version to call.
@acfoltzer acfoltzer requested a review from a team as a code owner August 30, 2023 18:48
@acfoltzer acfoltzer requested review from jameysharp and removed request for a team August 30, 2023 18:48
@jameysharp jameysharp requested review from alexcrichton and removed request for jameysharp August 30, 2023 19:57
@jameysharp
Copy link
Contributor

I'm handing review of this off to Alex as the author of the API you're extending.

I had hoped that the from_trusted_file entry-point or similar would suffice to avoid embedders needing to detect for themselves whether they were holding on to a precompiled module. However, it sounds like both of you have reasons why that wasn't enough. I don't want to think about it that hard so I'll leave you to it.

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Aug 30, 2023
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:api"

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

  • peterhuene: wasmtime:api

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

Learn more.

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, thanks!

I had hoped that the from_trusted_file entry-point or similar would suffice to avoid embedders needing to detect for themselves whether they were holding on to a precompiled module

Ah yeah I tried to use this when I originally refactored the CLI to take components, but the main reason I couldn't use it was that the CLI needed to dispatch to either Component::deserialize or Module::deserialize depending on what the compiled bytes were. I initially hoped to avoid ModuleOrComponent in the wasmtime crate's API but I think from_trusted_file would work there.

Overall at least from the CLI I felt that our API for loading modules/components is still kinda clunky. I couldn't really figure out a better replacement though so I gave up and added detect_precompiled. I'm definitely all-ears though for other suggestions!

@acfoltzer
Copy link
Contributor Author

I'm still getting acquainted with the component side of the crate API, but it seems like a ModuleOrComponent type is going to be necessary on the client side for pretty much any transitional project. If the expectation is that most applications will eventually move to the component model, I don't think it's worth codifying that sort of type in the crate API. But if you're feeling the pain while maintaining the CLI as well, it might be worth thinking more about some shared interfaces.

@acfoltzer acfoltzer added this pull request to the merge queue Aug 30, 2023
Merged via the queue into main with commit c4db8b2 Aug 30, 2023
20 checks passed
@acfoltzer acfoltzer deleted the acf/detect-precompiled-file branch August 30, 2023 23:35
eduardomourar pushed a commit to eduardomourar/wasmtime that referenced this pull request Sep 6, 2023
This is handy for users of `deserialize_file()` to determine which version to call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants