From c95b4ad2906ce4076f04e0969b7080c0589a8cea Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Aug 2003 15:41:47 +0000 Subject: * 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. --- src/fstate.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/fstate.cc') 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; } -- cgit v1.2.3