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

Implement 9p protocol against a local storage (IndexedDB, FileSystem API) #17

Open
jgoux opened this issue Sep 12, 2022 · 3 comments
Open

Comments

@jgoux
Copy link
Contributor

jgoux commented Sep 12, 2022

To have persistent sessions and files, we need to be able to write file changes to local storage in the browser.

As of today, we have two solutions:

  • IndexedDB
  • FileSystem API

An implementation already exists for IndexedDB: https://github.com/humphd/v86/tree/filer-9p-lastknowngood
The demo: https://humphd.github.io/browser-shell/
The 9p filesystem is mounted under /mnt in this case.

The difficulty we'll have is that we have 9p mounted as / in our case (all files are statically served), so I think we'll have to make a custom implementation where we will check if the file is available in IndexedDB, and if it's not we will fallback to the statically served file.

So we'll have a hosted layer (the current implementation), with a cached layer in-between.

Links about the 9p protocol:

@burggraf
Copy link
Collaborator

Is it not possible to mount two 9p filesystems at different mount points, one static and one for indexedDB?

@jgoux
Copy link
Contributor Author

jgoux commented Sep 12, 2022

Is it not possible to mount two 9p filesystems at different mount points, one static and one for indexedDB?

I'm not sure about that, we'll have to ask Fabian.

Even if you do this, we'll have to switch from one implementation to the other somehow.

@tomayac
Copy link

tomayac commented Oct 3, 2022

You may want to investigate the Origin Private File System. FYI, the SQLite team are looking into this as well for their upcoming Wasm port.

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

3 participants