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

idea: Provide OpenDAL as host functions for wasm runtimes #3970

Open
Xuanwo opened this issue Jan 11, 2024 · 2 comments
Open

idea: Provide OpenDAL as host functions for wasm runtimes #3970

Xuanwo opened this issue Jan 11, 2024 · 2 comments

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Jan 11, 2024

As demonstrated in @Zheaoli's opendal-wasmedge-demo, we can offer opendal as host functions for all of wasmtime, wasmedge and wasmer.

We can have the following design:

  • opendal will provide an opendal-wasm-sdk that exposes our wasm API. Users can use the sdk across different supported runtime.
  • opendal will provide host function modules for different wasm runtimes in opendal-wasm-module.

With those crates support, users can use opendal in this way:

  • Import opendal-wasm-sdk or calling opendal wasm api in their wasm code.
  • Using opendal-wasm-module to register host functions.
  • Load wasm code.

There are many ways to integrate with WASM, and OpenDAL plans to support for the following:

  • Compile to wasm32-unknown-unknown directly so users can use opendal in browser, tracked at Tracking issues of OpenDAL wasm32-unknown-unknown target support #3803
  • Compile to wasm32-wasi directly so users can use opendal in wasm runtime like wasmtime and wasmedge. (need to use crates like tokio-wasi, not started)
  • Split into host functions and client sdk, users will need to load functions when they start the runtime (this issue).
  • Integrate into runtimes directly that replace their fs implementation. (Is this possible?)
@Xuanwo Xuanwo changed the title idea: Provide OpenDAL as host functions for wasmtime/wasmedge idea: Provide OpenDAL as host functions for wasm runtimes Jan 11, 2024
@Zheaoli
Copy link
Member

Zheaoli commented Jan 11, 2024

Maybe I can propose more design details this week.

BTW, about the opendal-wasm-sdk, we can take a look at proxy-wasm-rust-sdk, FYI https://github.com/proxy-wasm/proxy-wasm-rust-sdk

@Xuanwo
Copy link
Member Author

Xuanwo commented Jan 16, 2024

@Zheaoli also mentioned a new way: https://wasmedge.org/docs/contribute/source/plugin/process

Provide a wasmedge plugin so users can:

wasmedge --dir .:. --reactor --process_plugin libopendal_wasmedge_plugin.so your_wasm_file.wasm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants