Add atomic write_bytes helper for upload temp files #11
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ModernLeft/athena-file#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Filed in support of athena-archive-api #81. The BE writes uploaded bytes to a temp file with raw `Path.write_bytes(file_content)` (utils.py:166), which is non-atomic — a crash mid-write leaves a half-written file.
Plan
Add a helper that takes `(target: Path, data: bytes)`, writes to `target.with_suffix(target.suffix + ".part")`, then `os.replace()` to the final path. Returns a `FileWorker` for the new file.
Could live as `FileWorker.from_bytes(target, data)` factory or as a standalone `atomic_write_bytes()` helper.
Acceptance criteria