File based "transactions"
Posted: Thu Jan 15, 2009 2:49 pm
Hello,
Just like SQL transactions, but in file based level. I have a pack of content that should be written into multiple different files, if any of them fail (the md5 doesn't match), then rollback all files to previous state.
The only reasonable way of accomplishing this seems to be looping through the content and check the md5's of the files and if any md5 match fails during loop then cancel whole operation otherwise loop through them again and this time make the actual changes to the files not just reading the content and comparing md5s.
Just like SQL transactions, but in file based level. I have a pack of content that should be written into multiple different files, if any of them fail (the md5 doesn't match), then rollback all files to previous state.
The only reasonable way of accomplishing this seems to be looping through the content and check the md5's of the files and if any md5 match fails during loop then cancel whole operation otherwise loop through them again and this time make the actual changes to the files not just reading the content and comparing md5s.