-
Notifications
You must be signed in to change notification settings - Fork 247
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
Update to Wasmtime 25 #2784
Update to Wasmtime 25 #2784
Conversation
60c5ece
to
b75d39a
Compare
b75d39a
to
c49e463
Compare
Ok Wasmtime 25 is now and this should be good to go 👍 |
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.
Largely looks good, but I have a question about two uses of the wasmtime API I don't fully understand.
Scheme::Http, | ||
Some(body), | ||
)?; | ||
let request = wasi_http.table().push(request)?; |
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.
Why are we manually creating the resource now instead of using WasiHttpView::new_incoming_request
?
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.
Ah this is caused by a refactoring from a few versions ago in Wasmtime where the error type of the body is required to be hyper::Error
for that helper but here it's ErrorCode
from wasi-http instead. The Wasmtime helper will convert from hyper::Error
to ErrorCode
but there's not currently a constructor that works with ErrorCode
itself. I tried to refactor Spin internals to use hyper::Error
instead but ended up running into roadblocks around service chaining where hyper::Error
was never materialized.
Perhaps the best solution would be to add a second helper or similar to the wasmtime-wasi-http crate though!
.context("no fermyon:spin/inbound-redis instance found")?; | ||
inbound_redis::Guest::new(&mut inbound_redis_export)? | ||
}; | ||
let guest_indices = inbound_redis::GuestIndices::new_instance(&mut store, &instance)?; |
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.
I'm not familiar with this GuestIndices
API in wasmtime, and I'm having a hard time understanding why this is used over the Guest::new
constructor. Can you explain this a bit?
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.
The short answer is that Guest::new
doesn't exist any more. The longer answer is that Wasmtime's now refactored to better support exported interfaces at different versions than listed in the WIT (e.g. automatically handling 0.2.1-but-you-gave-me-0.2.0 and situations like that). That refactoring ended up moving some things around and this is the way this is loaded now.
The other slightly long-answer bit is that most of the bindings are intended to operate at the world level but this is operating at the individual interface level which means that the APIs used here are somewhat non-standard in the sense that the top-level world bits that bindgen!
generates has all the helpers and individual interfaces are left to pull the pieces together individually. Perhaps something I can help refactor within Spin in the future?
c49e463
to
08643c6
Compare
This commit updates to Wasmtime 25.0.0 and handles the various fallout and changes throughout to account for API changes made. Signed-off-by: Alex Crichton <[email protected]>
08643c6
to
b151b31
Compare
This commit updates to Wasmtime 25.0.0 and handles the various fallout and changes throughout to account for API changes made.