diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-27T15·21+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-27T15·21+0000 |
commit | c505702265833a762d681952bcc72562d64a242e (patch) | |
tree | da6f095532755b766d7752d6925ea865ba0cefe2 /src/libstore/store.cc | |
parent | 59682e618805701f9c249736514df6db457895f9 (diff) |
* Fix and simplify the garbage collector (it's still not concurrent,
though). In particular it's now much easier to register a GC root. Just place a symlink to whatever store path it is that you want to keep in /nix/var/nix/gcroots.
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r-- | src/libstore/store.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc index f5e7d2aa58bb..30573992cc9e 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -363,9 +363,9 @@ void registerSubstitute(const Transaction & txn, } -Substitutes querySubstitutes(const Path & srcPath) +Substitutes querySubstitutes(const Transaction & txn, const Path & srcPath) { - return readSubstitutes(noTxn, srcPath); + return readSubstitutes(txn, srcPath); } @@ -411,6 +411,13 @@ static void invalidatePath(const Path & path, Transaction & txn) debug(format("unregistering path `%1%'") % path); nixDB.delPair(txn, dbValidPaths, path); + + /* Clear the `references' entry for this path, as well as the + inverse `referers' entries; but only if there are no + substitutes for this path. This maintains the cleanup + invariant. */ + if (querySubstitutes(txn, path).size() == 0) + setReferences(txn, path, PathSet()); } |