1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 15:40:59 +01:00

Make verifyAllValidPaths more functional

return map rather than mutate one passed in by reference
This commit is contained in:
John Ericson 2023-08-02 14:38:22 -04:00
parent 73c9fc7ab1
commit 6b297e5895
4 changed files with 19 additions and 12 deletions

View file

@ -243,19 +243,21 @@ void LocalOverlayStore::optimiseStore()
}
bool LocalOverlayStore::verifyAllValidPaths(RepairFlag repair, StorePathSet & validPaths)
std::pair<bool, StorePathSet> LocalOverlayStore::verifyAllValidPaths(RepairFlag repair)
{
StorePathSet done;
bool errors = false;
auto existsInStoreDir = [&](const StorePath & storePath) {
return pathExists(realStoreDir.get() + "/" + storePath.to_string());
};
bool errors = false;
StorePathSet validPaths;
for (auto & i : queryAllValidPaths())
verifyPath(i, existsInStoreDir, done, validPaths, repair, errors);
return errors;
return { errors, validPaths };
}