LegacySSHStore: Provide a faster implementation of computeFSClosure()

This avoids the latency of the standard implementation, which can make
a huge difference (e.g. 16.5s -> 0.5s on a NixOS system closure).
This commit is contained in:
Eelco Dolstra 2017-03-16 11:44:01 +01:00
parent 7a716ef2a5
commit ea7fa88131
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
2 changed files with 23 additions and 1 deletions

View File

@ -204,6 +204,28 @@ struct LegacySSHStore : public Store
bool isTrusted() override
{ return true; }
void computeFSClosure(const PathSet & paths,
PathSet & out, bool flipDirection = false,
bool includeOutputs = false, bool includeDerivers = false) override
{
if (flipDirection || includeDerivers) {
Store::computeFSClosure(paths, out, flipDirection, includeOutputs, includeDerivers);
return;
}
auto conn(connections->get());
conn->to
<< cmdQueryClosure
<< includeOutputs
<< paths;
conn->to.flush();
auto res = readStorePaths<PathSet>(*this, conn->from);
out.insert(res.begin(), res.end());
}
};
static RegisterStoreImplementation regStore([](

View File

@ -511,7 +511,7 @@ public:
`storePath' is returned; that is, the closures under the
`referrers' relation instead of the `references' relation is
returned. */
void computeFSClosure(const PathSet & paths,
virtual void computeFSClosure(const PathSet & paths,
PathSet & out, bool flipDirection = false,
bool includeOutputs = false, bool includeDerivers = false);