Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 4.44 KB

README.md

File metadata and controls

76 lines (51 loc) · 4.44 KB

AsterFs

AsterFs provides small, auditable cross-platform filesystem utilities for synchronous and asynchronous Rust. It is AsterCommunity's maintained fork of fs4, which in turn continues fs2.

AsterFs supplements gaps in Rust's standard library with explicit, tested filesystem guarantees. Its role in the Aster ecosystem is defined in #4: products use standard APIs directly when they meet their requirements; AsterFs owns additional platform mechanisms, not application workflows.

The fs2/fs4 lineage does not impose an API, feature-matrix, or MSRV compatibility obligation. Interfaces may be redesigned or removed according to real consumer needs; upstream attribution and licenses remain intact. Existing locking/runtime interfaces are current capabilities, not a promise to preserve their shape indefinitely.

Ecosystem scope

Capability Ownership and status
Physical allocation, allocated size, filesystem capacity Implemented mechanisms; preserve native errors and distinguish reserved storage from logical EOF
File locking and handle duplication Prefer std::fs::File on supported Rust versions (locking is stable since Rust 1.89); do not require AsterFs for these alone
Trusted-root file opening, link/file-identity checks Planned, tracked in #3; not available in 0.1.0
File replacement, durability, generic directory publication Candidate mechanisms; require consumers and explicit platform/failure guarantees before adding APIs

Platform syscalls belong inside AsterFs. ACME account/certificate formats, selected versions and recovery decisions, Forge panic rendering/redaction, cloud storage providers, scheduling and database state belong to consumers. AsterFs is not a facade for every std::fs call.

Windows may explicitly inherit directory permissions; dedicated ACL management is not a prerequisite for basic storage APIs. Inherited permissions must not be described as equivalent to Unix owner-private modes. Native runtime evidence is required for platform guarantees; cross-compilation alone is insufficient.

In particular, allocate(len) must reserve physical storage so later writes within that range do not fail for lack of space; changing only logical EOF is not sufficient.

Installation

Version 0.1.0 is published on crates.io:

[dependencies]
aster-fs = { version = "=0.1.0", default-features = false, features = ["sync"] }

Available runtime features:

Runtime / file type Feature
std::fs::File sync (default)
Tokio tokio
async-std async-std
Smol smol
fs-err v2 / v3 fs-err2, fs-err3
Tokio fs-err v2 / v3 fs-err2-tokio, fs-err3-tokio

The extension traits are exported from the crate root:

use aster_fs::FileExt;

let file = std::fs::File::create("reserved.bin")?;
file.allocate(128 * 1024 * 1024)?;
# Ok::<(), std::io::Error>(())

Platform contract

  • Linux and other supported Unix targets use rustix filesystem primitives and preserve native error codes.
  • Apple targets use all-or-nothing F_PREALLOCATE for new extents, validate fstore_t.fst_bytesalloc before extending logical EOF, and materialize actual holes when recovering an existing sparse file.
  • Windows uses FILE_ALLOCATION_INFO and reports native capacity errors such as ERROR_DISK_FULL.
  • Platforms without a real physical-preallocation primitive retain the upstream compatibility fallback; callers that require a hard reservation should restrict deployment to a verified backend.

Native runtime tests cover Linux, macOS, and Windows. The macOS CI path mounts a disposable size-limited APFS image to prove that an oversized request returns ENOSPC without leaving a partial allocation.

Async allocation delegates blocking filesystem work to the selected runtime's blocking pool, including sparse-hole recovery on Apple filesystems.

Current package information

  • Package: aster-fs
  • Crate: aster_fs
  • MSRV: Rust 1.75 for the default sync feature
  • License: MIT OR Apache-2.0

The async-std and smol features inherit the MSRV of their transitive dependencies, currently Rust 1.85.

Credits

AsterFs preserves the work and copyright of the fs4 and fs2 authors. See CHANGELOG.md, LICENSE-MIT, and LICENSE-APACHE.