Expand description
Safe filesystem state for Right Suite apps.
- [
atomic]: temp +fsync+ rename replacement, streaming writer, crash-orphan sweep. [atomic_write] is the one-call entry point. - [
lock]: OS advisory cross-process locks with owner/stale reporting. Two primitives: [FileLock::acquire] / [FileLock::try_acquire] take the exclusive lock, and [FileLock::acquire_shared] takes a shared (reader) lock. [LockKind] picks POSIX record locks (Fcntl, the default) orflock(2)(Flock) on Unix; [probe_owner] reads the owner record without locking. - [
write_locks] (featurelock): [KeyedWriteLocks], in-process write locks keyed by destination (directory identity plus name, nonexistent leaf allowed, no permanent map) with an optional cross-process lock file, to be used with [AtomicWriter]. - [
transaction] (featuretransaction): [FileTransaction] / [PreparedTransaction] / [recover_transactions], a crash-recoverable multi-file publication with a journal under the root (recoverability and serialized writers, not all-file atomic visibility). - [
transient] (featurefs): [transient::retry_transient], the one bounded retry (20 times, 100 ms apart, Windows only, the original error returned after the bound) for a delete, rename or open that Windows refuses with error 5, 32 or 33 while a scanner or indexer holds the file. - [
lease] (featurefs): [Lease], a pid + heartbeat-TTL lease file with stale-holder takeover (not an OS lock):try_acquire,renew,release,peek. - [
toolchain_lease] (featuretoolchain-lease): [ToolchainLease], a digest-bound immutable seal of toolchain trees (hash once, freeze with the OS immutable flag, replay by metadata only). - [
migrate] (featurefs): [migrate_dir] (alsoAppDirs::migrate_dir), a directory move that never shows a half-migrated destination (rename, or copy to a sibling then rename). - [
app_dirs] (featureapp-dirs): [AppDirs], one resolver for an app’s data, local, cache and home folders, with a dev namespace. - [
digest] (featuresdigest/blake3): SHA-256 / BLAKE3 of bytes or files, & lowercase hex. plain:canonicalize_plain,std::fs::canonicalizewithout the Windows verbatim drive prefix.contain:is_within,contain(),contain_lenientandRoots, path containment that follows links but refuses to leave a root; with featurefs, [open_confined] / [Roots::open_confined], a no-follow open that stays inside the approved folders.- [
handle] (featurefs): [final_path] and [link_count] of an open file, and [open_read_nofollow]. names:sanitize_file_namefor names that come from outside,numbered_candidates, and with featurefs[create_unique_file] / [create_download_file].publish_dir(featurefs):publish_dir(), an atomic directory replace.- [
trash] (featurefs): [move_to_trash], andtrash::{list, lookup, restore}(macOS, Windows and Linux). - [
journal] (featurelock): [JsonlJournal], an append journal that cuts a torn tail back. - [
retention], [confined_copy], [rename_case], [owned_temp], [malware_scan] (featurefs): a bounded set with all-or-nothing retirement, a link-refusing confined tree copy, a case-only rename, a temp for an external writer with a sweep, and an OS malware-scanner verdict. zip:StoredZipWriter, a deterministic stored-method ZIP writer, andcrc32; alsozip::{write_zip, read_zip, crc_table, crc32_update}for archives built from files on disk.- [
private]: owner-only files and directories (0600/0700, Windows DACL). - [
replaced]: [open_replaced] / [read_replaced], readers that retry, on Windows, an open a concurrent replace refused (access denied, sharing violation). - [
state]: [StateDir], a descriptor-pinned state directory (O_NOFOLLOW, fd-relative*atoperations) that a swapped or symlinked path cannot redirect. - [
identity] (featurefs; the ledger [IdentityStore] needsjson): stable file identity across renames and atomic replacement. - [
clone]: macOSclonefile(2)withCLONE_NOFOLLOW; [clone_file_nofollow] never falls back to a byte copy, [clone_or_link_or_copy_nofollow] tries clone, hard link, then copy. - [
swap]: macOSrenamex_np(RENAME_SWAP); atomically exchanges two paths ([swap_paths]).
Re-exports§
pub use contain::contain;pub use contain::contain_lenient;pub use contain::is_within;pub use contain::ContainError;pub use contain::Roots;pub use names::is_windows_reserved_name;pub use names::numbered_candidates;pub use names::sanitize_file_name;pub use names::sanitize_file_name_with;pub use names::NameOptions;pub use plain::canonicalize_plain;pub use plain::plain_path;pub use zip::crc32;pub use zip::stored_zip_bytes;pub use zip::StoredZipWriter;
Modules§
- contain
- Path containment, one module: is a path inside a root, resolve a relative path under a root, and open a file under a root without following links.
- names
- File names that come from somewhere else: sanitising a download name and picking a free one.
- plain
- Canonical paths without the Windows
\\?\verbatim prefix. - zip
- A deterministic ZIP writer that stores entries uncompressed.