3 ms·
One feature I wish filesystems had is transaction support, ie: begin transaction create file X if it doesn't exist, otherwise abort transaction write
by prirun 4y ago
One feature I wish filesystems had is transaction support, ie:
begin transaction
create file X if it doesn't exist, otherwise abort transaction
write some stuff to file X
open file Y
overwrite some data in file Y
if <insert condition here> commit transaction
end transaction
Nested transactions would be required as you'd have no idea whether you're already in a transaction.
Something like this can be coded (painfully) with renames, but it's unreliable, hard to test, and hard/impossible to coordinate with higher-level modules.
- kokojumbo 4y agoLooks beautiful, but what's the real life use case?
- prirun 4y agoYou have 2 databases to update. Either both have to be updated or neither, because you're installing a new version of a program. Actually, installing the new program should also be part of the transaction! Either the whole thing works, or you are back at the original (working) version of the program. Trying to coordinate all the filesystem operations to make that atomic is not that simple in my experience. It's hard to test too.
- kokojumbo 4y agoHmm... that could potentially allow to get rid of test environment like some redundant server that is a copy of production environment that one can use to test introduction of changes. Am I catching up what group of cases you have in mind more or less?
- quickthrower2 4y agoMaybe sqlite solves this too well?