aboutsummaryrefslogtreecommitdiff
path: root/src/fstate.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-08-01 15:41:47 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-08-01 15:41:47 +0000
commitc95b4ad2906ce4076f04e0969b7080c0589a8cea (patch)
treece3d6690834645117d2d6dfa714161fe97e09ca6 /src/fstate.cc
parentd99d04e6442dcc39a24cebac01af117ce00a5006 (diff)
* In normaliseFState(), wrap registration of the output paths and the
normal form in a single transaction to ensure that if we crash, either everything is registered or nothing is. This is for recoverability: unregistered paths in the store can be deleted arbitrarily, while registered paths can only be deleted by running the garbage collector.
Diffstat (limited to 'src/fstate.cc')
-rw-r--r--src/fstate.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fstate.cc b/src/fstate.cc
index 5da3d8358..2e2857ffc 100644
--- a/src/fstate.cc
+++ b/src/fstate.cc
@@ -44,7 +44,10 @@ FSId writeTerm(ATerm t, const string & suffix, FSId id)
// debug(format("written term %1% = %2%") % (string) id %
// printTerm(t));
- registerPath(path, id);
+ Transaction txn(nixDB);
+ registerPath(txn, path, id);
+ txn.commit();
+
return id;
}