Merge pull request #981 from shlevy/build-remote-c++

build-remote: Implement in C++
This commit is contained in:
Eelco Dolstra 2017-01-19 18:21:55 +01:00 committed by GitHub
commit 8af062f372
12 changed files with 334 additions and 30 deletions

View file

@ -46,33 +46,7 @@ struct CmdCopy : StorePathsCommand
ref<Store> srcStore = srcUri.empty() ? store : openStore(srcUri);
ref<Store> dstStore = dstUri.empty() ? store : openStore(dstUri);
std::string copiedLabel = "copied";
logger->setExpected(copiedLabel, storePaths.size());
ThreadPool pool;
processGraph<Path>(pool,
PathSet(storePaths.begin(), storePaths.end()),
[&](const Path & storePath) {
return srcStore->queryPathInfo(storePath)->references;
},
[&](const Path & storePath) {
checkInterrupt();
if (!dstStore->isValidPath(storePath)) {
Activity act(*logger, lvlInfo, format("copying %s...") % storePath);
copyStorePath(srcStore, dstStore, storePath);
logger->incProgress(copiedLabel);
} else
logger->incExpected(copiedLabel, -1);
});
pool.process();
copyPaths(srcStore, dstStore, storePaths);
}
};