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: Using WASMFS #2

Open
atty303 opened this issue May 19, 2024 · 3 comments
Open

Idea: Using WASMFS #2

atty303 opened this issue May 19, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request needs more info More information is needed to confirm or diagnose the issue

Comments

@atty303
Copy link

atty303 commented May 19, 2024

Emscripten has an experimental WASM-based FS implementation in addition to the current JS-based FS implementation.
The main difference that I am aware of is that JS-FS only allows synchronous processing, while WASM-FS allows asynchronous processing.
If you can do asynchronous processing, you can use ZenFS's asynchronous API and avoid all the problems associated with synchronizing asynchronous APIs.

I have implemented WASMFS Backend which uses ZenFS asynchronous API in my project.

atty303/pob-web:packages/driver/src/c/wasmfs/nodefs_js.cpp

It is closely tied to the user project and is not cut out to be generic. However, we thought it would be beneficial to have a generic ZenFS (or Node asynchronous API) backend. I think its implementation would need to be coordinated with the Emscripten project.
Not sure if this is ZenFS work, but I'll leave it as an idea.

@james-pre james-pre self-assigned this May 19, 2024
@james-pre
Copy link
Member

james-pre commented May 19, 2024

@atty303,

Could you elaborate more? "it would be beneficial to have a generic ZenFS (or Node asynchronous API) backend" is generic and ambiguous...

Do you mean a backend that uses another backend, and translates the calls to the ZenFS FileSystem?

@atty303
Copy link
Author

atty303 commented May 19, 2024

  1. Emscripten JS FS --[node:fs Sync API] --> ZenFS
  2. Emscripten WASMFS NodeFS Backend --[node:fs Async API]--> ZenFS

The current option is (1), but I meant that it would be nice to have (2).
My implementation is (2), but I have made the Emscripten WASMFS NodeFS Backend part tightly coupled with the project.
I said "generic" in the sense of making it loosely coupled and encapsulating it in the Emscripten side.
Is this an explanation?

@james-pre
Copy link
Member

So, you would like a C++ API for ZenFS? I think that would be really cool, though potentially a longer term goal. If your talking about a way to use ZenFS from Emscripten in general, src/plugin.ts has what you are looking for.

@james-pre james-pre added the enhancement New feature or request label Oct 10, 2024
@james-pre james-pre added the needs more info More information is needed to confirm or diagnose the issue label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs more info More information is needed to confirm or diagnose the issue
Projects
None yet
Development

No branches or pull requests

2 participants