[darcs-devel] Filesystem in DB, but data in filesystem

Salvatore Insalaco kirby81 at gmail.com
Sun Aug 5 14:55:02 PDT 2007


2007/8/4, David Roundy <droundy at darcs.net>:
> Here's something that should be pretty easy to do in combination with the
> above, if you design it in: atomic updates.  Atomic updates are actually
> pretty easy, since renameFile is atomic (except on Windows, where atomic
> updates aren't possible, so far as I know), and all of darcs' file-writing
> functions write a temp file first and then rename it to overwrite the
> existing file.  So if you write the new index and all files it indexes in
> the right order, the result is an atomic update, which will be very nice.

Do you mean something like:
1) Copy the file index
2) Write down all the temp files
3) Update the file index copy to point to temp files instead of real ones
4) Rename the file index to overwrite the original one

In this way, yes, we could achieve atomic updates, if renames are
atomic (if they are not, the only place when something can go wrong is
during the final rename, so we can arrange darcs repair to detect it
and complete the trasaction).

I'm a bit quiet lately, that's because I'm on vacation. I'll be back
at the end of month, until then I'll look at the mailing list once in
a while.

Salvatore


More information about the darcs-devel mailing list