pub fn atomic_write_symlink(path: &Path, data: &[u8]) -> Result<()>Expand description
Pick a random file name path.$RAND.atomic as real_path. Write data to
it. Then modify the symlink path to point to real_path. Attempt to
delete files that are no longer referred.
Since the symlink itself cannot be mmap-ed on Windows, this function is suitable for large mmap buffer on Windows. Without a symlink the mmap file has to be removed first, otherwise it cannot be replaced.
Unlike tempfile::NamedTempFile, this function does not chmod the file.
This function has a side effect of creating a path.lock file for
locking.
Attention: the deletion attempt is based on file name. So do not use
confusing file names like path.0001.atomic in the same directory.