mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Replace hasSubstitutes() with querySubstitutablePaths()
querySubstitutablePaths() takes a set of paths, so this greatly reduces daemon <-> client latency.
This commit is contained in:
parent
58ef4d9a95
commit
09a6321aeb
8 changed files with 52 additions and 24 deletions
|
@ -211,9 +211,12 @@ static int comparePriorities(EvalState & state,
|
|||
|
||||
static bool isPrebuilt(EvalState & state, const DrvInfo & elem)
|
||||
{
|
||||
assert(false);
|
||||
#if 0
|
||||
return
|
||||
store->isValidPath(elem.queryOutPath(state)) ||
|
||||
store->hasSubstitutes(elem.queryOutPath(state));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -931,8 +934,7 @@ static void opQuery(Globals & globals,
|
|||
|
||||
|
||||
/* Query which paths have substitutes. */
|
||||
SubstitutablePathInfos subs;
|
||||
PathSet validPaths;
|
||||
PathSet validPaths, substitutablePaths;
|
||||
if (printStatus) {
|
||||
PathSet paths;
|
||||
foreach (vector<DrvInfo>::iterator, i, elems2)
|
||||
|
@ -943,7 +945,7 @@ static void opQuery(Globals & globals,
|
|||
i->setFailed();
|
||||
}
|
||||
validPaths = store->queryValidPaths(paths);
|
||||
store->querySubstitutablePathInfos(paths, subs);
|
||||
substitutablePaths = store->querySubstitutablePaths(paths);
|
||||
}
|
||||
|
||||
|
||||
|
@ -969,7 +971,7 @@ static void opQuery(Globals & globals,
|
|||
|
||||
if (printStatus) {
|
||||
Path outPath = i->queryOutPath(globals.state);
|
||||
bool hasSubs = subs.find(outPath) != subs.end();
|
||||
bool hasSubs = substitutablePaths.find(outPath) != substitutablePaths.end();
|
||||
bool isInstalled = installed.find(outPath) != installed.end();
|
||||
bool isValid = validPaths.find(outPath) != validPaths.end();
|
||||
if (xmlOutput) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue