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

Aperta
#7,004 3 commenti 4 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #1 di @JMLX42 — chiusa senza merge
  • #7005 di @JMLX42 — chiusa senza merge

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust, wasm
Ambito
backend

Direzione di ricerca

Inizia esaminando il backend services-fs esistente e le specifiche collegate wasi:filesystem e Preview 2. Verifica come wasi:filesystem/types, preopens e wasi:io/streams si mappano sul backend proposto, quindi esegui la build per wasm32-wasip2. Il lavoro è completato quando un backend services-wasi-fs può accedere ai file preaperti dall’host durante la compilazione per la destinazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Rust
Stelle
5.5k
Fork
869
Merge medio
8h 2m
PR unite (30g)
862

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/opendal

Tutte le issue di apache/opendal

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.