feat(services): Add `wasi-fs` backend using `wasi:filesystem` interface

Open
#7,004 3 comments 4 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #1 by @JMLX42 — closed without merging
  • #7005 by @JMLX42 — closed without merging

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust, wasm
Domain
backend

Research direction

Start by reviewing the existing services-fs backend and the linked wasi:filesystem and Preview 2 specifications. Verify how wasi:filesystem/types, preopens, and wasi:io/streams map to the proposed backend, then build for wasm32-wasip2. Done means a services-wasi-fs backend can access host-preopened files while compiling for the target.

Written by the indexing model from the issue text.

Description

enhancement releases-note/feat rust
Summary

Add a new OpenDAL backend that leverages the wasi:filesystem interface for file operations. This enables OpenDAL to access the host filesystem when running as a WebAssembly component, with the host runtime (e.g., wasmtime, wasmer) providing the actual filesystem implementation.

Motivation

Currently, the services-fs backend cannot compile to wasm32-wasip2 because it depends on tokio's filesystem features, which are not supported on WASM targets.

However, WASM components can access the host filesystem through the standardized wasi:filesystem interface. A wasi-fs backend would:

  1. Enable filesystem access in WASM components — Components could read/write files preopened by the host runtime
  2. Complement existing backends — memory and s3 work on WASM, but there's no local filesystem option
  3. Leverage existing WASI ecosystem — Runtimes like wasmtime already implement wasi:filesystem
Proposed Implementation

A new services-wasi-fs feature/backend that:

  • Imports wasi:filesystem/types and wasi:filesystem/preopens interfaces
  • Uses wasi:io/streams for read/write operations
  • Works with preopened directories provided by the host
  • Compiles to wasm32-wasip2 target only (or conditional compilation)
Use Case

We're building WASM components that expose storage capabilities. We want to:

  1. Create an OpenDAL-based storage component
  2. Export wasi:filesystem interface for downstream consumers
  3. Support multiple backends (memory, S3, and host filesystem)

Without a wasi-fs backend, components cannot access files that the host runtime preopens for them.

Research Notes
Backend WASM-compatible Notes
services-memory ✅ Works out of the box
services-s3 ✅ Works with reqwest/reqsign
services-fs ❌ Requires tokio fs (not WASM-compatible)
services-wasi-fs 🆕 Proposed — uses wasi:filesystem imports
Related
Dominant language
Rust
Stars
5.5k
Forks
869
Avg merge
8h 2m
Merged PRs (30d)
862

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/opendal

All issues in apache/opendal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.