| Crates.io | fuser-async |
| lib.rs | fuser-async |
| version | 0.1.1 |
| created_at | 2025-02-25 21:01:09.213399+00 |
| updated_at | 2025-02-25 21:01:09.213399+00 |
| description | Build FUSE filesystems where the system calls are directed to async functions. With an example S3 implementation. |
| homepage | |
| repository | https://github.com/cpg314/fuser-async |
| max_upload_size | |
| id | 1569664 |
| size | 55,944 |
This crate, based on the fuser crate, allows building FUSE filesystems where the system calls are directed to async functions.
This can be particularly useful when the syscalls benefit from (or require) async IO.
When using a multi-threaded [tokio] runtime, this can also be useful for CPU-bound code
(although one should be careful with the interactions between IO- and CPU-bound tasks).
More precisely, this crate provides:
Filesystem] trait, analogous to the fuser [fuser::Filesystem] trait, which has all
its methods returning futures.FilesystemFUSE] struct, which can be constructed from any implementor of the [Filesystem]
trait, and which implements the [fuser::Filesystem] trait, allowing to mount the filesystem
using the fuser crate crate.Behind the scenes, [FilesystemFUSE] wraps the inner filesystem into an [std::sync::Arc<tokio::sync::RwLock>] and stores a handle on the [tokio] runtime.
Filesystem] trait.FilesystemFUSE] object from a instance implementing [Filesystem],
with [FilesystemFUSE::new].fuser], or use file handles programmatically with [FileHandle] (which implements [tokio::io::AsyncRead])let fs = TestFs::new();
let fuse = FilesystemFUSE::new(fs);
let _mount = fuser::spawn_mount2(
fuse,
mountpoint,
&[fuser::MountOption::RO, fuser::MountOption::Async],
)?;
tokio::signal::ctrl_c().await?;
Two example implementations are provided:
rusty_s3 crate.See the demo binary crate for a binary running these.
$ cargo run -r --features s3,demo --bin demo -- --help
USAGE:
demo [OPTIONS] <MOUNTPOINT> <SUBCOMMAND>
ARGS:
<MOUNTPOINT> Mountpoint
OPTIONS:
-d, --debug
-h, --help Print help information
SUBCOMMANDS:
local
s3
fuse_mtSee https://github.com/wfraser/fuse-mt/issues/3. The implementation of this crate is fairly similar to the prototype linked in this issue,
except that we use a recent [tokio] version and support different syscalls.
fuser::Filesystem] are supported (they are however easy to add). In particular, the current focus of is on read operations.