libstore: break up QueryMissingContext::doPath
std::visit makes coroutines nearly impossible to use correctly.
Change-Id: I085c08b595a5d4a43208eb97f023aa00b48bff45
This commit is contained in:
parent
74d820e5e8
commit
a911b44a31
|
@ -182,8 +182,17 @@ struct QueryMissingContext
|
||||||
if (!state->done.insert(req.to_string(store)).second) return;
|
if (!state->done.insert(req.to_string(store)).second) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::visit(overloaded {
|
std::visit(
|
||||||
[&](const DerivedPath::Built & bfd) {
|
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);
|
auto drvPathP = std::get_if<DerivedPath::Opaque>(&*bfd.drvPath);
|
||||||
if (!drvPathP) {
|
if (!drvPathP) {
|
||||||
// TODO make work in this case.
|
// TODO make work in this case.
|
||||||
|
@ -252,10 +261,10 @@ struct QueryMissingContext
|
||||||
pool.enqueue([=, this] { checkOutput(drvPath, drv, output, drvState); });
|
pool.enqueue([=, this] { checkOutput(drvPath, drv, output, drvState); });
|
||||||
} else
|
} else
|
||||||
mustBuildDrv(drvPath, *drv);
|
mustBuildDrv(drvPath, *drv);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
void doPathOpaque(const DerivedPath::Opaque & bo)
|
||||||
[&](const DerivedPath::Opaque & bo) {
|
{
|
||||||
|
|
||||||
if (store.isValidPath(bo.path)) return;
|
if (store.isValidPath(bo.path)) return;
|
||||||
|
|
||||||
SubstitutablePathInfos infos;
|
SubstitutablePathInfos infos;
|
||||||
|
@ -279,8 +288,6 @@ struct QueryMissingContext
|
||||||
|
|
||||||
for (auto & ref : info->second.references)
|
for (auto & ref : info->second.references)
|
||||||
pool.enqueue([this, path{DerivedPath::Opaque { ref }}] { doPath(path); });
|
pool.enqueue([this, path{DerivedPath::Opaque { ref }}] { doPath(path); });
|
||||||
},
|
|
||||||
}, req.raw());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue