Message146226
The recent issue #13146 renewed my interest, so I'd like to make this move forward, since I think an atomic rename/write API could be quite useful.
Issue #8604 (Adding an atomic FS write API) can be achieved relatively easily with the typical (fsync() left aside)
- create temporary file
- write to the temp file
- atomically rename the temp file to the target path
But the problem is that rename is only atomic on POSIX, and not on Windows.
So I'd suggest to:
- rename this issue to target specifically Windows ;-)
- add MoveFileTransacted to the standard library (PC/msvcrtmodule.c, posixmodule?)
I'm -1 on exposing a "best effort" atomic rename/file API: either the OS offers the primitives necessary to achieve atomicity, or it doesn't. It's better to have a working implementation on some OSes than a flaky implementation on every OS.
Note that I'll happily take over the atomic file API part (issue #8604), but since my Windows kung-fu is so poor, it'd be nice if someone with some Windows experience could tackle this MoveFileTransacted |
|
Date |
User |
Action |
Args |
2011-10-23 11:07:59 | neologix | set | recipients:
+ neologix, pitrou, vstinner, draghuram, techtonik, giampaolo.rodola, tarek, eric.araujo, r.david.murray, Trundle |
2011-10-23 11:07:59 | neologix | set | messageid: <1319368079.31.0.0860958044408.issue8828@psf.upfronthosting.co.za> |
2011-10-23 11:07:58 | neologix | link | issue8828 messages |
2011-10-23 11:07:58 | neologix | create | |
|