Hey, I was just looking at the file locking APIs in WIT together with @Wassim Chegham - and we think it's not going to be straight forward.
So for Rust we have my fd-lock crate which is implemented like a Mutex. You can either call a lock
method which will block until the lock has been released. Or you can call the try_lock
variants which immediately return a Result
indicating whether it was possible to take a lock out.
The JS version of this crate is the fd-lock
package which I based the Rust fd-lock
crate on.
However one issue with that is that it only provides the equivalent try_
versions. It does not provide a way to block until the lock has been released. And Node.js does not have generalized "block until some action" tooling that we can use for this.
Maybe there's a way we could swing this using LibUV APIs, or maybe atomics. But honestly: I've already heard people talk about removing file locking from the current Preview 2 conformance target. And I think that would be my preferred route to take here.
cc/ @Pat Hickey - I think you mentioned dropping file locking before. Do you have any thoughts on removing it from the current Preview 2 target?
file locking is officially dropped from p2
oh greattttt!
https://github.com/WebAssembly/wasi-filesystem/pull/136
ohhh, I think what happened is that I didn't update the issues on GitHub to reflect the updated APIs
I should do another pass on those
yep. np
ty ty ^^
Yoshua Wuyts has marked this topic as resolved.
Last updated: Dec 23 2024 at 13:07 UTC