mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
Get rid of verifyAllValidPaths
boolean blindness
This commit is contained in:
parent
c30b5d8a0b
commit
b21ee60594
4 changed files with 33 additions and 9 deletions
|
@ -252,7 +252,7 @@ void LocalOverlayStore::optimiseStore()
|
|||
}
|
||||
|
||||
|
||||
std::pair<bool, StorePathSet> LocalOverlayStore::verifyAllValidPaths(RepairFlag repair)
|
||||
LocalStore::VerificationResult LocalOverlayStore::verifyAllValidPaths(RepairFlag repair)
|
||||
{
|
||||
StorePathSet done;
|
||||
|
||||
|
@ -266,7 +266,10 @@ std::pair<bool, StorePathSet> LocalOverlayStore::verifyAllValidPaths(RepairFlag
|
|||
for (auto & i : queryAllValidPaths())
|
||||
verifyPath(i, existsInStoreDir, done, validPaths, repair, errors);
|
||||
|
||||
return { errors, validPaths };
|
||||
return {
|
||||
.errors = errors,
|
||||
.validPaths = validPaths,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ private:
|
|||
* We don't verify the contents of both layers on the assumption that the lower layer is far bigger,
|
||||
* and also the observation that anything not in the upper db the overlayfs doesn't yet care about.
|
||||
*/
|
||||
std::pair<bool, StorePathSet> verifyAllValidPaths(RepairFlag repair) override;
|
||||
VerificationResult verifyAllValidPaths(RepairFlag repair) override;
|
||||
|
||||
/**
|
||||
* Deletion only effects the upper layer, so we ignore lower-layer referrers.
|
||||
|
|
|
@ -1443,7 +1443,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
|||
}
|
||||
|
||||
|
||||
std::pair<bool, StorePathSet> LocalStore::verifyAllValidPaths(RepairFlag repair)
|
||||
LocalStore::VerificationResult LocalStore::verifyAllValidPaths(RepairFlag repair)
|
||||
{
|
||||
StorePathSet storePathsInStoreDir;
|
||||
/* Why aren't we using `queryAllValidPaths`? Because that would
|
||||
|
@ -1476,7 +1476,10 @@ std::pair<bool, StorePathSet> LocalStore::verifyAllValidPaths(RepairFlag repair)
|
|||
for (auto & i : queryAllValidPaths())
|
||||
verifyPath(i, existsInStoreDir, done, validPaths, repair, errors);
|
||||
|
||||
return { errors, validPaths };
|
||||
return {
|
||||
.errors = errors,
|
||||
.validPaths = validPaths,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -264,12 +264,30 @@ public:
|
|||
|
||||
bool verifyStore(bool checkContents, RepairFlag repair) override;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* @return A pair of whether any errors were encountered, and a set of
|
||||
* (so-far) valid paths. The store objects pointed to by those paths are
|
||||
* suitable for further validation checking.
|
||||
* Result of `verifyAllValidPaths`
|
||||
*/
|
||||
virtual std::pair<bool, StorePathSet> verifyAllValidPaths(RepairFlag repair);
|
||||
struct VerificationResult {
|
||||
/**
|
||||
* Whether any errors were encountered
|
||||
*/
|
||||
bool errors;
|
||||
|
||||
/**
|
||||
* A set of so-far valid paths. The store objects pointed to by
|
||||
* those paths are suitable for further validation checking.
|
||||
*/
|
||||
StorePathSet validPaths;
|
||||
};
|
||||
|
||||
/**
|
||||
* First, unconditional step of `verifyStore`
|
||||
*/
|
||||
virtual VerificationResult verifyAllValidPaths(RepairFlag repair);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Register the validity of a path, i.e., that `path` exists, that
|
||||
|
|
Loading…
Reference in a new issue