aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-08-02 12:45:55 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-08-02 12:46:07 -0400
commit66550878dffe2a4bf55ea7ab694738aa14e6a01e (patch)
tree7e9b87f30e51a65773ac8206330668a62bc1f553 /src/libstore/local-store.cc
parent770d50e49cce4d8ce5e546fe31beaa253505bfa5 (diff)
Add comment explaining the use of `readDirectory(realStoreDir)`
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 982a9059c..40a3bc194 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1503,6 +1503,15 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
{
StorePathSet storePathsInStoreDir;
+ /* Why aren't we using `queryAllValidPaths`? Because that would
+ tell us about all the paths than the database knows about. Here we
+ want to know about all the store paths in the store directory,
+ regardless of what the database thinks.
+
+ We will end up cross-referencing these two sources of truth (the
+ database and the filesystem) in the loop below, in order to catch
+ invalid states.
+ */
for (auto & i : readDirectory(realStoreDir)) {
try {
storePathsInStoreDir.insert({i.name});