mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
Merge pull request #12296 from DeterminateSystems/release-source-early
addMultipleToStore(): Move pathsToCopy
This commit is contained in:
commit
263a818bee
4 changed files with 10 additions and 6 deletions
|
@ -534,14 +534,17 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source,
|
||||||
|
|
||||||
|
|
||||||
void RemoteStore::addMultipleToStore(
|
void RemoteStore::addMultipleToStore(
|
||||||
PathsSource & pathsToCopy,
|
PathsSource && pathsToCopy,
|
||||||
Activity & act,
|
Activity & act,
|
||||||
RepairFlag repair,
|
RepairFlag repair,
|
||||||
CheckSigsFlag checkSigs)
|
CheckSigsFlag checkSigs)
|
||||||
{
|
{
|
||||||
auto source = sinkToSource([&](Sink & sink) {
|
auto source = sinkToSource([&](Sink & sink) {
|
||||||
sink << pathsToCopy.size();
|
sink << pathsToCopy.size();
|
||||||
for (auto & [pathInfo, pathSource] : pathsToCopy) {
|
// Reverse, so we can release memory at the original start
|
||||||
|
std::reverse(pathsToCopy.begin(), pathsToCopy.end());
|
||||||
|
while (!pathsToCopy.empty()) {
|
||||||
|
auto & [pathInfo, pathSource] = pathsToCopy.back();
|
||||||
WorkerProto::Serialise<ValidPathInfo>::write(*this,
|
WorkerProto::Serialise<ValidPathInfo>::write(*this,
|
||||||
WorkerProto::WriteConn {
|
WorkerProto::WriteConn {
|
||||||
.to = sink,
|
.to = sink,
|
||||||
|
@ -549,6 +552,7 @@ void RemoteStore::addMultipleToStore(
|
||||||
},
|
},
|
||||||
pathInfo);
|
pathInfo);
|
||||||
pathSource->drainInto(sink);
|
pathSource->drainInto(sink);
|
||||||
|
pathsToCopy.pop_back();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public:
|
||||||
CheckSigsFlag checkSigs) override;
|
CheckSigsFlag checkSigs) override;
|
||||||
|
|
||||||
void addMultipleToStore(
|
void addMultipleToStore(
|
||||||
PathsSource & pathsToCopy,
|
PathsSource && pathsToCopy,
|
||||||
Activity & act,
|
Activity & act,
|
||||||
RepairFlag repair,
|
RepairFlag repair,
|
||||||
CheckSigsFlag checkSigs) override;
|
CheckSigsFlag checkSigs) override;
|
||||||
|
|
|
@ -223,7 +223,7 @@ StorePath Store::addToStore(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Store::addMultipleToStore(
|
void Store::addMultipleToStore(
|
||||||
PathsSource & pathsToCopy,
|
PathsSource && pathsToCopy,
|
||||||
Activity & act,
|
Activity & act,
|
||||||
RepairFlag repair,
|
RepairFlag repair,
|
||||||
CheckSigsFlag checkSigs)
|
CheckSigsFlag checkSigs)
|
||||||
|
@ -1138,7 +1138,7 @@ std::map<StorePath, StorePath> copyPaths(
|
||||||
pathsToCopy.push_back(std::pair{infoForDst, std::move(source)});
|
pathsToCopy.push_back(std::pair{infoForDst, std::move(source)});
|
||||||
}
|
}
|
||||||
|
|
||||||
dstStore.addMultipleToStore(pathsToCopy, act, repair, checkSigs);
|
dstStore.addMultipleToStore(std::move(pathsToCopy), act, repair, checkSigs);
|
||||||
|
|
||||||
return pathsMap;
|
return pathsMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,7 @@ public:
|
||||||
CheckSigsFlag checkSigs = CheckSigs);
|
CheckSigsFlag checkSigs = CheckSigs);
|
||||||
|
|
||||||
virtual void addMultipleToStore(
|
virtual void addMultipleToStore(
|
||||||
PathsSource & pathsToCopy,
|
PathsSource && pathsToCopy,
|
||||||
Activity & act,
|
Activity & act,
|
||||||
RepairFlag repair = NoRepair,
|
RepairFlag repair = NoRepair,
|
||||||
CheckSigsFlag checkSigs = CheckSigs);
|
CheckSigsFlag checkSigs = CheckSigs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue