Sean Middleditch wrote:
[...]
So far as implementation, this really is easy even with a (single)
file-
based backend. Robustness might take some work, but the basics are
easy. You simply keep a list of all they keys that have been set, and
when the Commit command comes along, lock the file(s) in question and
modify them. On Rollback, just "forget" all the key changes that
haven't been committed yet. Basically the hard part for the simple file
backend is getting the commit to stay atomic on errors when you use
multiple files. If you have multiple files being changed, I don't
believe it's actually possible to be 100% atomic - you can reduce the
chances of something breaking, but there will always be various race
conditions in regards to when errors occur that could leave you in a
half-committed state.
rename is atomic. You can always use this fact if you need to.