aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index e3d23fdfb..6e4cd053c 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -932,16 +932,24 @@ template<class T> T getIntLine(int fd)
}
-bool LocalStore::hasSubstitutes(const Path & path)
+PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
{
+ PathSet res;
foreach (Paths::iterator, i, substituters) {
+ if (res.size() == paths.size()) break;
RunningSubstituter & run(runningSubstituters[*i]);
startSubstituter(*i, run);
- writeLine(run.to, "have\n" + path);
- if (getIntLine<int>(run.from)) return true;
+ string s = "have ";
+ foreach (PathSet::const_iterator, i, paths)
+ if (res.find(*i) == res.end()) { s += *i; s += " "; }
+ writeLine(run.to, s);
+ while (true) {
+ Path path = readLine(run.from);
+ if (path == "") break;
+ res.insert(path);
+ }
}
-
- return false;
+ return res;
}