mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02: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
|
@ -653,7 +653,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
results.paths.insert(path);
|
||||
|
||||
uint64_t bytesFreed;
|
||||
deleteGCPath(realPath, bytesFreed);
|
||||
deleteStorePath(realPath, bytesFreed);
|
||||
|
||||
results.bytesFreed += bytesFreed;
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
void queryRealisationUncached(const DrvOutput&,
|
||||
Callback<std::shared_ptr<const Realisation>> callback) noexcept override;
|
||||
|
||||
void deleteGCPath(const Path & path, uint64_t & bytesFreed) override;
|
||||
void deleteStorePath(const Path & path, uint64_t & bytesFreed) override;
|
||||
|
||||
void optimiseStore() override;
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ AutoCloseFD LocalStore::openGCLock()
|
|||
}
|
||||
|
||||
|
||||
void LocalStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
|
||||
void LocalStore::deleteStorePath(const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
deletePath(path, bytesFreed);
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
* The default implementation simply calls `deletePath`, but it can be
|
||||
* overridden by stores that wish to provide their own deletion behaviour.
|
||||
*/
|
||||
virtual void deleteGCPath(const Path & path, uint64_t & bytesFreed);
|
||||
virtual void deleteStorePath(const Path & path, uint64_t & bytesFreed);
|
||||
|
||||
/**
|
||||
* Optimise the disk space usage of the Nix store by hard-linking
|
||||
|
|
Loading…
Reference in a new issue