Skip to main content

Crate eryx_vfs

Crate eryx_vfs 

Source
Expand description

Virtual Filesystem for Eryx Sandbox

Provides a custom wasi:filesystem implementation backed by a key-value store, allowing sandboxed Python code to read and write files that persist across sandbox executions.

§Architecture

The VFS consists of:

  • VfsStorage - A trait for pluggable storage backends
  • InMemoryStorage - An in-memory implementation for testing
  • WASI host implementations that bridge storage to the component model

§Usage

use eryx_vfs::{InMemoryStorage, VfsCtx, VfsState, VfsView, add_vfs_to_linker};
use std::sync::Arc;

// Create storage
let storage = Arc::new(InMemoryStorage::new());

// Create VFS context
let mut vfs_ctx = VfsCtx::new(storage);

// Add WASI to linker first, then override filesystem with VFS
wasmtime_wasi::p2::add_to_linker_async(&mut linker)?;
add_vfs_to_linker(&mut linker)?;

Re-exports§

pub use hybrid::HybridDescriptor;
pub use hybrid::HybridPreopen;
pub use hybrid::HybridVfsCtx;
pub use hybrid::HybridVfsState;
pub use hybrid::RealDir;
pub use hybrid::RealFile;
pub use hybrid::RestrictedDir;
pub use scrubbing::FileScrubPolicy as VfsFileScrubPolicy;
pub use scrubbing::ScrubbingStorage;
pub use scrubbing::SecretConfig as VfsSecretConfig;

Modules§

hybrid
Hybrid VFS that routes paths to either VFS storage or real filesystem.
scrubbing
Storage wrapper that scrubs secret placeholders from file writes.

Structs§

ArcStorage
Type-erased VFS storage that wraps any VfsStorage implementation.
DirEntry
A directory entry returned by listing.
DirPerms
Permission bits for operating on a directory.
FilePerms
HybridReaddirIterator
Iterator for hybrid directory entries.
InMemoryStorage
In-memory VFS storage implementation.
Metadata
Metadata for a file or directory.
VfsCtx
Context for VFS operations.
VfsDescriptor
A file or directory descriptor in the VFS.
VfsReaddirIterator
Iterator over directory entries.
VfsState
A view into the VFS state for WASI trait implementations.

Enums§

VfsError
Errors that can occur during VFS operations.

Traits§

HybridVfsView
Marker trait for types that provide hybrid VFS access.
VfsStorage
Trait for VFS storage backends.
VfsView
Marker trait for types that provide VFS access.

Functions§

add_hybrid_vfs_to_linker
Add hybrid VFS filesystem interfaces to a linker.
add_vfs_to_linker
Add VFS filesystem interfaces to a linker.

Type Aliases§

VfsResult
Result type for VFS operations.