I assume that there is some graceful design pattern for a program which may modify or write more than one file when run to:
- Write some number of temporary files… creating the expected output files as part of what the program does.
- If the process breaks or exits unexpectedly while creating files, no harm no foul: existing files are as they were when the user called the program.
- Move/write any existing files being edited/created to temporary storage.
- Move/copy the temporary files from step 1 to where output expects them to be.
- Confirm they are there (maybe checksum them as part of that confirmation?).
- Maybe moving old files back if the confirmation on the new files broke somehow?
- Delete temporary files, and call it done.
Is this kind of thing packed up nicely in a Python 3.x module? (And is there a common name for this kind of design pattern?)
I am not a CS type, and not a professional developer, so Answers For Newbs-level language is welcome.
Aucun commentaire:
Enregistrer un commentaire