mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
Fix deletion test
Lower layer references are ignored for deleting just in the upper layer.
This commit is contained in:
parent
19c43c5d78
commit
07b34edc44
4 changed files with 30 additions and 1 deletions
|
@ -741,7 +741,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
auto i = referrersCache.find(*path);
|
||||
if (i == referrersCache.end()) {
|
||||
StorePathSet referrers;
|
||||
queryReferrers(*path, referrers);
|
||||
queryGCReferrers(*path, referrers);
|
||||
referrersCache.emplace(*path, std::move(referrers));
|
||||
i = referrersCache.find(*path);
|
||||
}
|
||||
|
|
|
@ -138,6 +138,12 @@ void LocalOverlayStore::queryReferrers(const StorePath & path, StorePathSet & re
|
|||
}
|
||||
|
||||
|
||||
void LocalOverlayStore::queryGCReferrers(const StorePath & path, StorePathSet & referrers)
|
||||
{
|
||||
LocalStore::queryReferrers(path, referrers);
|
||||
}
|
||||
|
||||
|
||||
StorePathSet LocalOverlayStore::queryValidDerivers(const StorePath & path)
|
||||
{
|
||||
auto res = LocalStore::queryValidDerivers(path);
|
||||
|
@ -188,6 +194,7 @@ void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LocalOverlayStore::optimiseStore()
|
||||
{
|
||||
Activity act(*logger, actOptimiseStore);
|
||||
|
@ -216,6 +223,7 @@ Path LocalOverlayStore::toRealPathForHardLink(const StorePath & path)
|
|||
: Store::toRealPath(path);
|
||||
}
|
||||
|
||||
|
||||
static RegisterStoreImplementation<LocalOverlayStore, LocalOverlayStoreConfig> regLocalOverlayStore;
|
||||
|
||||
}
|
||||
|
|
|
@ -115,7 +115,16 @@ private:
|
|||
|
||||
void optimiseStore() override;
|
||||
|
||||
/**
|
||||
* For lower-store paths, we used the lower store location. This avoids the
|
||||
* wasteful "copying up" that would otherwise happen.
|
||||
*/
|
||||
Path toRealPathForHardLink(const StorePath & storePath) override;
|
||||
|
||||
/**
|
||||
* Deletion only effects the upper layer, so we ignore lower-layer referrers.
|
||||
*/
|
||||
void queryGCReferrers(const StorePath & path, StorePathSet & referrers) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -230,6 +230,18 @@ public:
|
|||
|
||||
void collectGarbage(const GCOptions & options, GCResults & results) override;
|
||||
|
||||
/**
|
||||
* Called by `collectGarbage` to trace in reverse.
|
||||
*
|
||||
* Using this rather than `queryReferrers` directly allows us to
|
||||
* fine-tune which referrers we consider for garbage collection;
|
||||
* some store implementations take advantage of this.
|
||||
*/
|
||||
virtual void queryGCReferrers(const StorePath & path, StorePathSet & referrers)
|
||||
{
|
||||
return queryReferrers(path, referrers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by `collectGarbage` to recursively delete a path.
|
||||
* The default implementation simply calls `deletePath`, but it can be
|
||||
|
|
Loading…
Reference in a new issue