Skip to main content

Crate rightkit_fs

Crate rightkit_fs 

Source
Expand description

Safe filesystem state for Right Suite apps.

  • atomic: temp + fsync + rename replacement, streaming writer, crash-orphan sweep.
  • lock: OS advisory cross-process locks with owner/stale reporting.
  • private: owner-only files and directories (0600/0700, Windows DACL).
  • state: StateDir, a descriptor-pinned state directory (O_NOFOLLOW, fd-relative *at operations) that a swapped or symlinked path cannot redirect.
  • identity: stable file identity across renames and atomic replacement.
  • clone: macOS clonefile(2) with CLONE_NOFOLLOW; never falls back to a byte copy.

Re-exports§

pub use atomic::atomic_write;
pub use atomic::atomic_write_private;
pub use atomic::atomic_write_with;
pub use atomic::sweep_stale_temps;
pub use atomic::AtomicOptions;
pub use atomic::AtomicWriter;
pub use clone::clone_file_nofollow;
pub use clone::CloneError;
pub use error::FsError;
pub use error::Result;
pub use identity::FileKey;
pub use identity::IdentityStore;
pub use identity::Resolution;
pub use identity::StableId;
pub use identity::Tracked;
pub use lock::with_lock;
pub use lock::FileLock;
pub use lock::LockOptions;
pub use lock::LockOwner;
pub use netfs::is_network_filesystem;
pub use private::create_private_new;
pub use private::ensure_private_dir;
pub use private::restrict_owner_only;
pub use private::sweep_owner_only;
pub use private::write_private_file;
pub use private::write_private_text;
pub use state::EntryKind;
pub use state::EntryStat;
pub use state::StateDir;

Modules§

atomic
Atomic file replacement: temp file in the destination directory, fsync, rename over the target, fsync the directory. Readers see the old content or the new content, never a mix, and a crash at any point leaves the old file intact plus (at worst) an orphan temp file that sweep_stale_temps reclaims.
clone
Copy-on-write file clones that never fall back to a byte copy.
error
identity
Stable file identity across renames.
lock
Cross-process advisory file locks.
netfs
Is a path on a network or remote filesystem? SQLite WAL (shared-memory locking) and OS advisory locks are unreliable there, so callers pick rollback journaling / refuse to rely on lock files. Donor: CodeRight private_fs::journal (statfs / UNC / OneDrive detection).
private
Owner-only files and directories.
state
A descriptor-pinned state directory.

Functions§

process_alive
Whether process pid currently exists.