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

Add an option to choose FS implementation for JS BE #821

Open
konsoletyper opened this issue Oct 14, 2023 · 0 comments
Open

Add an option to choose FS implementation for JS BE #821

konsoletyper opened this issue Oct 14, 2023 · 0 comments

Comments

@konsoletyper
Copy link
Owner

Current implementation of FS in JS keeps everything in memory. In real world cases users may want to keep their files in persistent storage. Filesystem support in TeaVM already relies on interface, which has implementations (in-memory and WASI), so it's only a matter of providing extra implementations as well as a way to pass compiler the name of desired implementation (TeaVM properties can be used for example).

It's reasonable to have two additional implementations for JS BE:

  1. Asynchronous, which keeps everything in memory, but eventually flushes in-memory changes into persistent storage (i.e. IndexedDB). This is necessary, since IndexedDB itself asynchronous and if we want to keep good performance by preventing turning Java methods into state machine, we can use this implementation. This implementation would also require that main method starts asynchronously to make sure that all data read from IndexedDB into memory.
  2. Synchronous, which never keeps data in memory, and all reads/writes all data 'synchronously', from Java's standpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant