mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
build-remote: Implement in C++
This commit is contained in:
parent
2af5d35fdc
commit
167d12b02c
12 changed files with 338 additions and 30 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "store-api.hh"
|
||||
#include "util.hh"
|
||||
#include "nar-info-disk-cache.hh"
|
||||
#include "thread-pool.hh"
|
||||
|
||||
#include <future>
|
||||
|
||||
|
@ -698,4 +699,36 @@ std::list<ref<Store>> getDefaultSubstituters()
|
|||
}
|
||||
|
||||
|
||||
void copyPaths(ref<Store> from, ref<Store> to, const Paths & storePaths)
|
||||
{
|
||||
std::string copiedLabel = "copied";
|
||||
|
||||
logger->setExpected(copiedLabel, storePaths.size());
|
||||
|
||||
ThreadPool pool;
|
||||
|
||||
processGraph<Path>(pool,
|
||||
PathSet(storePaths.begin(), storePaths.end()),
|
||||
|
||||
[&](const Path & storePath) {
|
||||
return from->queryPathInfo(storePath)->references;
|
||||
},
|
||||
|
||||
[&](const Path & storePath) {
|
||||
checkInterrupt();
|
||||
|
||||
if (!to->isValidPath(storePath)) {
|
||||
Activity act(*logger, lvlInfo, format("copying ‘%s’...") % storePath);
|
||||
|
||||
copyStorePath(from, to, storePath);
|
||||
|
||||
logger->incProgress(copiedLabel);
|
||||
} else
|
||||
logger->incExpected(copiedLabel, -1);
|
||||
});
|
||||
|
||||
pool.process();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue