mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 20:51:00 +01:00
* 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.
This commit is contained in:
parent
59682e6188
commit
c505702265
10 changed files with 124 additions and 109 deletions
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue