Qubit FS
qubit-fs is a provider-neutral, synchronous and asynchronous filesystem
abstraction for Rust 1.94 or later. It supplies application-facing concrete
facades—FileSystem and AsyncFileSystem—instead of choosing a storage backend
or an async runtime for you.
Installation
[]
= "0.2"
Synchronous APIs are enabled by default. Enable the asynchronous facade explicitly when it is needed:
= { = "0.2", = ["async"] }
Quick Start
A report job can keep its reads and writes on FileSystem while provider setup
chooses the storage authority. This executable demo creates an isolated local
root, writes a report, reads it with a 1 KiB limit, and prints report ready.
The temporary directory is removed when the demo ends.
[]
= "0.2"
= "0.9"
= "3"
use Path;
use CopyExecutionRoute;
use CopyOptions;
use ListScope;
use ReadOptions;
use PrefixReadTermination;
use WriteOptions;
use LocalFileSystems;
use LocalResourcePolicy;
For a report assembled in several writes, create a temporary file under the
same logical parent, write through its returned path, and call persist only
when generation is complete. The final report name then stays free of
incomplete output. If publication fails, use the retained publication fact,
source qualification, and publication_target() to decide between retry,
cleanup, and read-only reconciliation.
Why This Project Exists
Application code often needs the same read, write, copy, and listing workflow across local disks, object stores, and hosted filesystems, but provider SDKs expose different path models, error shapes, and recovery behavior. Scattering provider details through business logic makes retries, cleanup, and cancellation hard to reason about after a partial failure.
qubit-fs keeps applications on concrete FileSystem and AsyncFileSystem
facades while providers implement extension contracts under qubit_fs::spi.
Provider discovery, configuration, and credential handling stay in
qubit-fs-registry, so the core crate does not embed a backend or async runtime.
What It Provides—and What It Does Not
The stable application surface is the public facade API, typed paths and URIs, explicit listing scopes, bounded reads, and recovery objects that retain publication facts across failed writes, copies, and cancellations. Detailed workflows, error tables, and operational limits are in the user guide; provider integration is documented separately.
The facade makes these semantics explicit:
Pathis a logical name inside one configured filesystem.Uriis the secret-free canonical addressing form, whileConnectionUriis configuration ingress: it may accept credentials but redacts them inDisplayandDebug.- Default URI parsing uses the fixed standard redaction policy; pass an explicit
policy to
Uri::parse_with_policyorConnectionUri::parse_with_policywhen application-specific query names must be protected. - Copy, rename, writes, and temporary-resource publication (including
keep) preserve typed recovery facts. Temporary persistence reports target publication separately from source qualification, andpublication_target()retains an earlier confirmed target across rejected retries, cleanup failures, and asynchronous cancellation. Inspect both facts before retrying, cleaning up, or reconciling a visible target. existsreturnsfalseonly whenstatreportsNotFound; permission, authentication, timeout, and I/O failures remain errors.DirectoryStreamreads entries incrementally. Consume it in a bounded loop instead of assuming that a directory is a preloaded collection.- Listing uses explicit
ListScope::Pathor flatListScope::Namespace; prefix reads add a byte range only whenRangeReadis Guaranteed.
The core crate has no built-in backend and does not select an async runtime. It does not implement cross-filesystem move, guarantee every provider capability, or turn object keys into hierarchical paths without provider-specific rules. Platform roots and authority boundaries come from the configured provider.
Learn More
- English user guide
- 中文用户手册
- English provider guide
- 中文 provider 指南
- Architecture design
- 中文架构设计
- API documentation on docs.rs
- 中文 README
- Repository
Testing
# Run tests with the default feature set
# Run tests with all declared features
# Project CI checks
# Check code coverage
License
Copyright (c) 2025 - 2026. Haixing Hu. All rights reserved.
Licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Contributing
Contributions are welcome. Please follow the Rust API guidelines, keep public
API documentation and tests current, and run ./align-ci.sh to format code and
./ci-check.sh to satisfy CI requirements before submitting a pull request.
Author
Haixing Hu - Qubit Co. Ltd.
Repository: https://github.com/qubit-ltd/rs-fs