libstore: break up QueryMissingContext::doPath

std::visit makes coroutines nearly impossible to use correctly.

Change-Id: I085c08b595a5d4a43208eb97f023aa00b48bff45
This commit is contained in:
eldritch horrors 2024-11-17 14:43:57 +01:00
parent 74d820e5e8
commit a911b44a31

View file

@ -182,8 +182,17 @@ struct QueryMissingContext
if (!state->done.insert(req.to_string(store)).second) return;
}
std::visit(overloaded {
[&](const DerivedPath::Built & bfd) {
std::visit(
overloaded{
[&](const DerivedPath::Built & bfd) { doPathBuilt(bfd); },
[&](const DerivedPath::Opaque & bo) { doPathOpaque(bo); },
},
req.raw()
);
}
void doPathBuilt(const DerivedPath::Built & bfd)
{
auto drvPathP = std::get_if<DerivedPath::Opaque>(&*bfd.drvPath);
if (!drvPathP) {
// TODO make work in this case.
@ -252,10 +261,10 @@ struct QueryMissingContext
pool.enqueue([=, this] { checkOutput(drvPath, drv, output, drvState); });
} else
mustBuildDrv(drvPath, *drv);
}
},
[&](const DerivedPath::Opaque & bo) {
void doPathOpaque(const DerivedPath::Opaque & bo)
{
if (store.isValidPath(bo.path)) return;
SubstitutablePathInfos infos;
@ -279,8 +288,6 @@ struct QueryMissingContext
for (auto & ref : info->second.references)
pool.enqueue([this, path{DerivedPath::Opaque { ref }}] { doPath(path); });
},
}, req.raw());
}
};
}