opendal icon indicating copy to clipboard operation
opendal copied to clipboard

Add Origin Private File System support

Open stormshield-guillaumed opened this issue 2 years ago • 8 comments

There is a recent Web API providing access to a file system private to the origin of the page. This could be useful for a cross platform application targeting desktop and WASM, using either the fs backend on desktop or the new backend on WASM.

It is not a small task, but maybe some people could find this interesting.

stormshield-guillaumed avatar Jun 09 '23 09:06 stormshield-guillaumed

Interesting! I plan to make OpenDAL work in wasm first and than add OPFS support.

Xuanwo avatar Jun 09 '23 10:06 Xuanwo

We are ready for this now!

Xuanwo avatar Dec 22 '23 09:12 Xuanwo

That's great news ! Unfortunately, AFAIK, there is no high level API for interacting with OPFS in Rust at the moment, but the building blocks are in web-sys. The addition of OPFS was discussed in https://github.com/rustwasm/wasm-bindgen/issues/2868 if anyone is interested.

stormshield-guillaumed avatar Dec 22 '23 10:12 stormshield-guillaumed

We need to wait for https://github.com/rustwasm/wasm-bindgen/issues/3755

Xuanwo avatar Dec 27 '23 03:12 Xuanwo

Hello, everyone. This issue has been submitted as this year's OSPP project. I hope we can push this issue forward.

Xuanwo avatar Apr 30 '24 09:04 Xuanwo

Apply for this project: https://summer-ospp.ac.cn/org/prodetail/241110348

Goal

Add Origin Private File System (OPFS) support for opendal so that users can use opfs in wasm runtime or browser.

The usage will look like:

let op = Operator::via_map(Scheme::Opfs, map)?;
let bs = op.read("path/to/file").await?;

opfs should only be provided in wasm32 target.

Requirement

  • Know about Origin Private File System
  • Know about how to build/test rust project
  • Better to have some knowledge about WASM

Mentorship

Mentor: @PsiACE Discussion: mailing list and discord

Xuanwo avatar Apr 30 '24 10:04 Xuanwo

I'm interested!

LYZJU2019 avatar Jun 17 '24 07:06 LYZJU2019

cc @PsiACE and @LYZJU2019, any updates on this?

Xuanwo avatar Sep 09 '24 14:09 Xuanwo

Here are my brief ideas on implementing this service.

Tasks

  • [ ] setup servies (add deps, figure out CI, add Access place holder)
  • [ ] implement core features
    • [ ] read and stat
    • [ ] list
    • [ ] write and create_dir
    • [ ] delete
  • [ ] setup tests
  • [ ] examples and docs

Xuanwo avatar Mar 08 '25 04:03 Xuanwo

I believe we should focus on getting our services layout ready first. https://github.com/apache/opendal/pull/5269 is almost ready but still needs some work. Maybe we can leave all functions unimplemented for now.

Hi, @LYZJU2019 do you have time to address the comments in PR? Or maybe @Eason0729 can help based on your existing work.

Xuanwo avatar Mar 08 '25 04:03 Xuanwo

Hi @Xuanwo , thanks for bringing this up.

I'm happy to help out if @LYZJU2019 isn’t available. However, I’m new to this codebase, and I won’t be available for the next week. Once I’m back, I can jump in and take a look.

Eason0729 avatar Mar 09 '25 14:03 Eason0729

I have open a new issue for OPFS, hopefully we can have a working OPFS in browser soon.

Eason0729 avatar Mar 18 '25 06:03 Eason0729