mirror of
https://github.com/NixOS/nix.git
synced 2025-12-03 07:31:00 +01:00
Reuse deletion logic for optimiseStore and rename method.
This commit is contained in:
parent
11c493f8fa
commit
33ebae75ca
5 changed files with 8 additions and 7 deletions
|
|
@ -176,7 +176,7 @@ void LocalOverlayStore::registerValidPaths(const ValidPathInfos & infos)
|
|||
}
|
||||
|
||||
|
||||
void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
|
||||
void LocalOverlayStore::deleteStorePath(const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
auto mergedDir = realStoreDir.get() + "/";
|
||||
if (path.substr(0, mergedDir.length()) != mergedDir) {
|
||||
|
|
@ -198,7 +198,7 @@ void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
|
|||
} else {
|
||||
// Path does not exist in lower store.
|
||||
// So we can delete via overlayfs and not need to remount.
|
||||
LocalStore::deleteGCPath(path, bytesFreed);
|
||||
LocalStore::deleteStorePath(path, bytesFreed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -217,8 +217,9 @@ void LocalOverlayStore::optimiseStore()
|
|||
|
||||
for (auto & path : paths) {
|
||||
if (lowerStore->isValidPath(path)) {
|
||||
uint64_t bytesFreed = 0;
|
||||
// Deduplicate store path
|
||||
deletePath(toUpperPath(path));
|
||||
deleteStorePath(Store::toRealPath(path), bytesFreed);
|
||||
}
|
||||
done++;
|
||||
act.progress(done, paths.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue