Skip to main content

Module private_fs

Module private_fs 

Source
Expand description

Owner-only files and directories for hosts that write run data to disk.

Run stores, scores, replay cassettes and evaluation reports hold prompts, model answers and user data. Written with the default umask (often 022) they are readable by every local user, so hosts create them through these helpers instead: 0600 files and 0700 directories on Unix. Other platforms rely on the per-user ACLs of the parent directory.

Modes only apply to what these functions create: an existing file or directory keeps its permissions, so an operator’s deliberate chmod is respected. Atomic replaces (write a new temporary file, then rename) always end up owner-only.

Constants§

PRIVATE_DIR_MODE
Mode of directories created here (Unix).
PRIVATE_FILE_MODE
Mode of files created here (Unix).

Functions§

append_file
Open path for appending, creating it owner-only when missing.
create_dir_all
Create path and its missing parents, each new one owner-only.
create_file
Open path for writing, truncating it, creating it owner-only when missing.
create_fresh_temp_dir
Create a new, owner-only directory under the system temp directory, named <prefix>-<pid>-<counter>-<nanos>.
write
Write bytes to path (like std::fs::write), creating it owner-only.