1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 06:52:43 +01:00

Hacky fast closure copying mechanism

This commit is contained in:
Eelco Dolstra 2021-06-29 21:17:48 +02:00
parent bef40c2949
commit 3d9de41a5b
6 changed files with 55 additions and 1 deletions

View file

@ -505,6 +505,17 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
break;
}
case wopImportPaths2: {
logger->startWork();
auto paths = store->importPaths(from,
trusted ? NoCheckSigs : CheckSigs);
logger->stopWork();
Strings paths2;
for (auto & i : paths) paths2.push_back(store->printStorePath(i));
to << paths2;
break;
}
case wopBuildPaths: {
auto drvs = readDerivedPaths(*store, clientVersion, from);
BuildMode mode = bmNormal;

View file

@ -875,6 +875,16 @@ void RemoteStore::queryMissing(const std::vector<DerivedPath> & targets,
}
StorePaths RemoteStore::importPaths(Source & source, CheckSigsFlag checkSigs)
{
auto conn(getConnection());
conn->to << wopImportPaths2;
source.drainInto(conn->to);
conn.processStderr();
return worker_proto::read(*this, conn->from, Phantom<StorePaths> {});
}
void RemoteStore::connect()
{
auto conn(getConnection());

View file

@ -112,6 +112,8 @@ public:
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
uint64_t & downloadSize, uint64_t & narSize) override;
StorePaths importPaths(Source & source, CheckSigsFlag checkSigs) override;
void connect() override;
unsigned int getProtocol() override;

View file

@ -676,7 +676,7 @@ public:
the Nix store. Optionally, the contents of the NARs are
preloaded into the specified FS accessor to speed up subsequent
access. */
StorePaths importPaths(Source & source, CheckSigsFlag checkSigs = CheckSigs);
virtual StorePaths importPaths(Source & source, CheckSigsFlag checkSigs = CheckSigs);
struct Stats
{
@ -766,6 +766,7 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
RepairFlag repair = NoRepair,
CheckSigsFlag checkSigs = CheckSigs,
SubstituteFlag substitute = NoSubstitute);
std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStore,
const StorePathSet & paths,
RepairFlag repair = NoRepair,

View file

@ -55,6 +55,7 @@ typedef enum {
wopQueryDerivationOutputMap = 41,
wopRegisterDrvOutput = 42,
wopQueryRealisation = 43,
wopImportPaths2 = 44, // hack
} WorkerOp;