mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Factor out GC path deletion so it can be overridden.
This commit is contained in:
parent
b852bdb3f8
commit
98edbb9686
2 changed files with 16 additions and 2 deletions
|
@ -654,7 +654,8 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
results.paths.insert(path);
|
||||
|
||||
uint64_t bytesFreed;
|
||||
deletePath(realPath, bytesFreed);
|
||||
deleteGCPath(realPath, bytesFreed);
|
||||
|
||||
results.bytesFreed += bytesFreed;
|
||||
|
||||
if (results.bytesFreed > options.maxFreed) {
|
||||
|
@ -872,7 +873,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
if (unlink(path.c_str()) == -1)
|
||||
throw SysError("deleting '%1%'", path);
|
||||
|
||||
/* Do not accound for deleted file here. Rely on deletePath()
|
||||
/* Do not account for deleted file here. Rely on deletePath()
|
||||
accounting. */
|
||||
}
|
||||
|
||||
|
@ -890,6 +891,12 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
}
|
||||
|
||||
|
||||
void GcStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
deletePath(path, bytesFreed);
|
||||
}
|
||||
|
||||
|
||||
void LocalStore::autoGC(bool sync)
|
||||
{
|
||||
static auto fakeFreeSpaceFile = getEnv("_NIX_TEST_FREE_SPACE_FILE");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue