Skip to main content

Crate choir_fs

Crate choir_fs 

Source
Expand description

Durable-file utilities shared by the binaries (internal/oak.md item 6): atomic replace-by-rename writes, a private variant for secrets, and a PID-bearing directory lock that enforces one writer process.

Ported from Oak (oak.space) cli/src/atomic_file.rs and cli/src/workdir_lock.rs, v0.102.1 (commit 8de9515), Apache-2.0; adapted to std errors and this workspace’s needs.

§Where this sits

docs/architecture.md is the map of the whole workspace. This crate is the durable-file primitives — atomic writes and a working-directory lock — that the binaries share.

It depends on no other crate in this workspace.

Re-exports§

pub use atomic_file::write_atomic;
pub use atomic_file::write_atomic_private;
pub use workdir_lock::LockError;
pub use workdir_lock::WorkdirLock;

Modules§

atomic_file
Atomic file replacement: write a temp file in the destination directory, sync it, rename it into place, sync the parent directory. Readers see the old contents or the new, never a torn write, and a crash between any two steps leaves the destination untouched.
workdir_lock
A process-level lock on a directory: a PID-bearing lock file created with create_new, reaped when its owner is provably dead. Guards state a single process may write, e.g. a node’s .choir dir, where two writers appending one ops.jsonl would fork the chain.