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

OPFS support for OpenDAL (draft PR) #5269

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

LYZJU2019
Copy link

Which issue does this PR close?

Closes #2442 .

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@LYZJU2019 LYZJU2019 requested a review from Xuanwo as a code owner November 1, 2024 22:16
@LYZJU2019 LYZJU2019 marked this pull request as draft November 1, 2024 22:16
@@ -381,6 +381,20 @@ prometheus-client = { version = "0.22.2", optional = true }
tracing = { version = "0.1", optional = true }
# for layers-dtrace
probe = { version = "0.5.1", optional = true }
wasm-bindgen = "0.2.95"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, please mark those dependencies as optional and hide them under the services-opfs feature to ensure other builds aren't affected.

access_info
.set_scheme(Scheme::Opfs)
.set_native_capability(Capability {
stat: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave them as false until we actually implement them.

Arc::new(access_info)
}

async fn create_dir(&self, path: &str, _: OpCreateDir) -> Result<RpCreateDir> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have default implementations for those functions, so we can remove unsupported operations.

impl OpfsCore {
pub async fn store_file(file_name: &str, content: &[u8]) -> Result<(), JsValue> {
// Access the OPFS
let navigator = window().unwrap().navigator();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try your best to avoid using unwrap(), and return an error instead.

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

Successfully merging this pull request may close these issues.

Add Origin Private File System support
2 participants