1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +02:00

Implement overlay store deduplication.

This commit is contained in:
Ben Radford 2023-07-19 12:32:32 +01:00
parent a9510f9502
commit 8ddbcb736a
No known key found for this signature in database
GPG key ID: 9DF5D4640AB888D5
2 changed files with 18 additions and 3 deletions

View file

@ -190,7 +190,23 @@ void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
void LocalOverlayStore::optimiseStore()
{
warn("not implemented");
Activity act(*logger, actOptimiseStore);
// Note for LocalOverlayStore, queryAllValidPaths only returns paths in upper layer
auto paths = queryAllValidPaths();
act.progress(0, paths.size());
uint64_t done = 0;
for (auto & path : paths) {
if (lowerStore->isValidPath(path)) {
// Deduplicate store path
deletePath(toUpperPath(path));
}
done++;
act.progress(done, paths.size());
}
}
bool LocalOverlayStore::verifyStore(bool checkContents, RepairFlag repair)