Restore data integrity guarantees: Content-MD5 validation, fsync durability, atomic metadata writes, concurrent write protection

This commit is contained in:
2026-03-07 17:54:00 +08:00
parent be63e27c15
commit 72f5d9d70c
3 changed files with 97 additions and 42 deletions

View File

@@ -46,6 +46,8 @@ pub fn stream_to_file_with_md5(
py.check_signals()?;
}
file.sync_all()
.map_err(|e| PyIOError::new_err(format!("Failed to fsync: {}", e)))?;
Ok(())
})();
@@ -102,6 +104,9 @@ pub fn assemble_parts_with_md5(
}
}
target.sync_all()
.map_err(|e| PyIOError::new_err(format!("Failed to fsync: {}", e)))?;
Ok(format!("{:x}", hasher.finalize()))
})
}