-
Notifications
You must be signed in to change notification settings - Fork 21
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
Implement preopened_dir using set_mapped_directories setting #427
base: main
Are you sure you want to change the base?
Implement preopened_dir using set_mapped_directories setting #427
Conversation
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.
Wasmtime's API for this takes 1 dir at a time -- not a collection of (src, dest)
. Unless we have a reason to, I'd rather stick to the Rust API shape and naming.
Sticking to the rust crate API been a general rule of thumb for the Ruby bindings. In this case, it makes the API easier to describe. Especially as we eventually migrate to wasmtime_wasi
instead of wasi_common
which has additional params for permissions.
lib/wasmtime/version.rb
Outdated
VERSION = "29.0.0" | ||
VERSION = "30.0.0" |
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.
Please do not bump the version number
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.
Ok
ext/src/ruby_api/wasi_ctx_builder.rs
Outdated
use magnus::{ | ||
class, function, gc::Marker, method, typed_data::Obj, value::Opaque, DataTypeFunctions, Error, | ||
Module, Object, RArray, RHash, RString, Ruby, TryConvert, TypedData, | ||
Integer, Module, Object, RArray, RHash, RString, Ruby, TryConvert, TypedData, |
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 don't see Integer
being used, I think we can revert that?
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.
True, I will revert this.
@@ -47,6 +49,7 @@ struct WasiCtxBuilderInner { | |||
stderr: Option<WriteStream>, | |||
env: Option<Opaque<RHash>>, | |||
args: Option<Opaque<RArray>>, | |||
mapped_directories: Option<Opaque<RArray>>, |
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.
When holding references to Ruby objects, we must GC mark them, otherwise the GC might collect the object. See WasiCtxBuilderInner::mark
on L56 for how it's done.
Should I just append one by one to the array and then call the |
Sounds reasonable to me. The array should contain Let me know once you're done with the change and the tests. |
… set only one mapping per call
I have updated the way how |
I can take a look at cleaning it up once the tests are in -- care to add those in? |
No description provided.