-
Notifications
You must be signed in to change notification settings - Fork 703
feat(services): Add wasi-fs backend using wasi:filesystem interface #7005
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
Open
JMLX42
wants to merge
15
commits into
apache:main
Choose a base branch
from
lx-industries:feat/services-wasi-fs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
76ebd71
feat(services/wasi-fs): add crate skeleton
JMLX42 1119e8e
feat(services/wasi-fs): add error handling
JMLX42 149bc30
feat(services/wasi-fs): add config and builder
JMLX42 8c01f0f
feat(services/wasi-fs): implement WASI filesystem service
JMLX42 69f627a
chore: update Cargo.lock with wasi dependency
JMLX42 4b4dbaa
docs: add wasi-fs environment template
JMLX42 6633311
ci: add wasi-fs service setup action
JMLX42 dba6437
test: add wasi-fs test runner script
JMLX42 d076544
ci: add wasi-fs behavior test workflow
JMLX42 38cfd69
fix(services/wasi-fs): fix compilation errors for wasm32-wasip2
JMLX42 5810f7d
fix(services/wasi-fs): gate re-export by target platform
JMLX42 a8ea33b
ci(wasi-fs): use allowed actions in CI workflow
JMLX42 a1256ab
ci(wasi-fs): use cargo check instead of behavior tests
JMLX42 01f2bec
fix(services/wasi-fs): remove simulated copy capability
JMLX42 681baa1
refactor(services/wasi-fs): remove unnecessary . and .. check in lister
JMLX42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: Check WASI-FS Service | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'core/services/wasi-fs/**' | ||
| - 'core/core/src/**' | ||
| - '.github/workflows/test_wasi_fs.yml' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'core/services/wasi-fs/**' | ||
| - 'core/core/src/**' | ||
| - '.github/workflows/test_wasi_fs.yml' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Rust toolchain | ||
| uses: ./.github/actions/setup | ||
|
|
||
| - name: Add wasm32-wasip2 target | ||
| run: rustup target add wasm32-wasip2 | ||
|
|
||
| # Verify the wasi-fs service compiles for the WASI target. | ||
| # Note: Full behavior tests cannot run because tokio doesn't support wasm32-wasip2. | ||
| # The service uses blocking WASI Preview 2 APIs which work correctly at runtime. | ||
| - name: Check wasi-fs compiles | ||
| working-directory: core | ||
| run: | | ||
| cargo check --target wasm32-wasip2 \ | ||
| --features services-wasi-fs \ | ||
| -p opendal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/bash | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Test runner for wasi-fs service | ||
| # Requires: wasmtime, wasm32-wasip2 target | ||
|
|
||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| CORE_DIR="$(dirname "$SCRIPT_DIR")" | ||
| TEST_DIR="${TEST_DIR:-/tmp/opendal-wasi-fs-test}" | ||
|
|
||
| echo "=== WASI-FS Behavior Test Runner ===" | ||
| echo "Test directory: $TEST_DIR" | ||
|
|
||
| # Create test directory | ||
| mkdir -p "$TEST_DIR" | ||
|
|
||
| # Build behavior tests for wasm32-wasip2 | ||
| echo "Building behavior tests for wasm32-wasip2..." | ||
| cd "$CORE_DIR" | ||
| cargo build --tests --target wasm32-wasip2 --features tests,services-wasi-fs | ||
|
|
||
| # Find the test binary | ||
| TEST_BINARY=$(find target/wasm32-wasip2/debug/deps -name "behavior-*.wasm" | head -1) | ||
|
|
||
| if [ -z "$TEST_BINARY" ]; then | ||
| echo "Error: Could not find behavior test binary" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Running tests with wasmtime..." | ||
| echo "Binary: $TEST_BINARY" | ||
|
|
||
| # Run with wasmtime, granting access to test directory | ||
| OPENDAL_TEST=wasi-fs \ | ||
| OPENDAL_WASI_FS_ROOT=/ \ | ||
| wasmtime run \ | ||
| --dir "$TEST_DIR::/" \ | ||
| --env "OPENDAL_TEST=wasi-fs" \ | ||
| --env "OPENDAL_WASI_FS_ROOT=/" \ | ||
| "$TEST_BINARY" | ||
|
|
||
| echo "=== Tests completed ===" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [package] | ||
| description = "Apache OpenDAL WASI filesystem service implementation" | ||
| name = "opendal-service-wasi-fs" | ||
|
|
||
| authors = { workspace = true } | ||
| edition = { workspace = true } | ||
| homepage = { workspace = true } | ||
| license = { workspace = true } | ||
| repository = { workspace = true } | ||
| rust-version = { workspace = true } | ||
| version = { workspace = true } | ||
|
|
||
| [package.metadata.docs.rs] | ||
| all-features = true | ||
|
|
||
| [dependencies] | ||
| opendal-core = { path = "../../core", version = "0.55.0", default-features = false } | ||
|
|
||
| ctor = { workspace = true } | ||
| serde = { workspace = true, features = ["derive"] } | ||
|
|
||
| [target.'cfg(all(target_arch = "wasm32", target_os = "wasi"))'.dependencies] | ||
| wasi = "0.14.7" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to not use scripts. We can just move those logic to github workflows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Xuanwo you mean inlining the script into the github workflow?