pub fn migrate_file_in_place(
path: &Path,
) -> Result<Option<MigrateReport>, Error>Expand description
File-API wrapper: read disk config, migrate, write <file>.backup
adjacent to the original, then atomically replace the original. Returns
Ok(None) when already current.
Backup file is <config_filename>.backup (joined cross-platform via
Path ops). The write path mirrors Config::save() so the documented
durability guarantee holds end-to-end:
- Write the migrated content to
<path>.tmp-<uuid>and fsync it. - Copy the original to
<path>.backup(existing behavior; recovery rope if anything later goes wrong). rename(<path>.tmp, <path>)— atomic on Unix and on modern Windows.- Fsync the parent directory so the rename is durable.
On rename failure the temp file is removed and the backup is restored over the original so the operator never observes a partial write.