Expand description
Small platform differences that the rest of the code should not have to know about.
replace_file: the “write a temp file, rename it over the target” step. On Windows a rename over a file another process has open (an antivirus scan, a backup agent, a reader) fails with a sharing violation that clears within moments, so it is retried a bounded number of times.network_fs: whether a path is on a network filesystem. SQLite’s WAL mode needs shared memory and locks that NFS and SMB do not provide reliably, so a vault there can corrupt;unv doctorsays so instead of letting it happen quietly.
Functions§
- is_unc
- A Windows UNC path (
\\server\share\...), which is always a network location. - network_
fs - The name of the network filesystem
pathlives on, orNonewhen it is local or unknown. - parse_
mount_ output - The same for the output of
mounton macOS:host:/export on /Volumes/x (nfs, nodev, ...). - parse_
proc_ mounts - The filesystem type of the longest mount point that contains
path, from/proc/mountstext. - replace_
file - Renames
fromoverto. On Windows a sharing violation is retried briefly; elsewhere this is a plain rename, which is already atomic. - retry
- Runs
op, repeating up toATTEMPTStimes whiletransientsays the error will pass.