diff --git a/src/libstore/gc-store.hh b/src/libstore/gc-store.hh index da1551056..2c26c65c4 100644 --- a/src/libstore/gc-store.hh +++ b/src/libstore/gc-store.hh @@ -97,13 +97,6 @@ struct GcStore : public virtual Store * Perform a garbage collection. */ virtual void collectGarbage(const GCOptions & options, GCResults & results) = 0; - - /** - * Called by `collectGarbage` to recursively delete a path. - * 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); }; } diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 959f4d3b1..80875efed 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -891,12 +891,6 @@ 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"); diff --git a/src/libstore/local-overlay-store.cc b/src/libstore/local-overlay-store.cc index f42b37324..061478c52 100644 --- a/src/libstore/local-overlay-store.cc +++ b/src/libstore/local-overlay-store.cc @@ -222,7 +222,7 @@ void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed) return; } if (pathExists(toUpperPath({path.substr(mergedDir.length())}))) { - GcStore::deleteGCPath(path, bytesFreed); + LocalStore::deleteGCPath(path, bytesFreed); } } diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 17385cdfb..172fa1ef0 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -457,6 +457,12 @@ AutoCloseFD LocalStore::openGCLock() } +void LocalStore::deleteGCPath(const Path & path, uint64_t & bytesFreed) +{ + deletePath(path, bytesFreed); +} + + LocalStore::~LocalStore() { std::shared_future future; diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 46a660c68..fcddffa82 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -222,6 +222,13 @@ public: void collectGarbage(const GCOptions & options, GCResults & results) override; + /** + * Called by `collectGarbage` to recursively delete a path. + * 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); + /** * Optimise the disk space usage of the Nix store by hard-linking * files with the same contents.