1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 09:19:36 +01:00

Make the DrvOutputSubstitutionGoal more async

This commit is contained in:
regnat 2021-10-28 16:43:54 +02:00
parent fbc70034b3
commit f4c869977c
2 changed files with 51 additions and 5 deletions

View file

@ -3,6 +3,8 @@
#include "store-api.hh"
#include "goal.hh"
#include "realisation.hh"
#include <thread>
#include <future>
namespace nix {
@ -25,6 +27,13 @@ private:
/* The remaining substituters. */
std::list<ref<Store>> subs;
/* The current substituter. */
std::shared_ptr<Store> sub;
Pipe outPipe;
std::thread thr;
std::promise<std::shared_ptr<const Realisation>> promise;
/* Whether a substituter failed. */
bool substituterFailed = false;
@ -36,6 +45,7 @@ public:
void init();
void tryNext();
void realisationFetched();
void outPathValid();
void finished();
@ -44,7 +54,7 @@ public:
string key() override;
void work() override;
void handleEOF(int fd) override;
};
}