42GoalPtr upcast_goal(std::shared_ptr<PathSubstitutionGoal> subGoal);
43GoalPtr upcast_goal(std::shared_ptr<DrvOutputSubstitutionGoal> subGoal);
44GoalPtr upcast_goal(std::shared_ptr<DerivationGoal> subGoal);
46typedef std::chrono::time_point<std::chrono::steady_clock> steady_time_point;
57 std::set<MuxablePipePollState::CommChannel> channels;
64 steady_time_point timeStarted;
81 , evalStore(evalStore) {};
85 void buildPaths(
const std::vector<DerivedPath> & reqs, BuildMode buildMode)
override;
86 std::vector<KeyedBuildResult>
97 inline std::shared_ptr<Worker> getWorker()
99 return std::make_shared<Worker>(*store, *evalStore);
129 WeakGoals wantingToBuild;
134 WeakGoals wantingToSubstitute;
139 std::list<Child> children;
145 size_t nrLocalBuilds;
150 size_t nrSubstitutions;
159 std::map<StorePath, std::map<OutputName, std::weak_ptr<DerivationGoal>>> derivationGoals;
160 std::map<StorePath, std::weak_ptr<DerivationResolutionGoal>> derivationResolutionGoals;
161 std::map<StorePath, std::weak_ptr<DerivationBuildingGoal>> derivationBuildingGoals;
162 std::map<StorePath, std::weak_ptr<PathSubstitutionGoal>> substitutionGoals;
163 std::map<DrvOutput, std::weak_ptr<DrvOutputSubstitutionGoal>> drvOutputSubstitutionGoals;
168 WeakGoals waitingForAWhile;
173 WeakGoals waitingForCompletion;
178 steady_time_point lastWokenUp;
183 std::map<StorePath, bool> pathContentsGoodCache;
199 Sync<std::queue<WeakGoalPtr>> wakeupQueue_;
203 void wakeAll(Worker & worker);
213 void enqueue(WeakGoalPtr goal);
250 std::unique_ptr<HookInstance> hook;
253 uint64_t expectedBuilds = 0;
254 uint64_t doneBuilds = 0;
255 uint64_t failedBuilds = 0;
256 uint64_t runningBuilds = 0;
258 uint64_t expectedSubstitutions = 0;
259 uint64_t doneSubstitutions = 0;
260 uint64_t failedSubstitutions = 0;
261 uint64_t runningSubstitutions = 0;
262 uint64_t expectedDownloadSize = 0;
263 uint64_t doneDownloadSize = 0;
264 uint64_t expectedNarSize = 0;
265 uint64_t doneNarSize = 0;
284 template<
class G,
typename...
Args>
285 std::shared_ptr<G> initGoalIfNeeded(std::weak_ptr<G> & goal_weak,
Args &&... args);
287 std::shared_ptr<DerivationTrampolineGoal> makeDerivationTrampolineGoal(
291 std::shared_ptr<DerivationTrampolineGoal> makeDerivationTrampolineGoal(
292 const StorePath & drvPath,
const OutputsSpec & wantedOutputs,
const Derivation & drv, BuildMode buildMode);
294 std::shared_ptr<DerivationGoal> makeDerivationGoal(
299 bool storeDerivation);
304 std::shared_ptr<DerivationResolutionGoal>
310 std::shared_ptr<DerivationBuildingGoal>
317 const StorePath & storePath, RepairFlag repair = NoRepair, std::optional<ContentAddress> ca = std::nullopt);
318 std::shared_ptr<DrvOutputSubstitutionGoal> makeDrvOutputSubstitutionGoal(
const DrvOutput &
id);
361 const std::set<MuxablePipePollState::CommChannel> & channels,
363 bool respectTimeouts);
417 void markContentsGood(
const StorePath & path);
419 void updateProgress()
421 actDerivations.progress(doneBuilds, expectedBuilds + doneBuilds, runningBuilds, failedBuilds);
422 actSubstitutions.progress(
423 doneSubstitutions, expectedSubstitutions + doneSubstitutions, runningSubstitutions, failedSubstitutions);
424 act.setExpected(actFileTransfer, expectedDownloadSize + doneDownloadSize);
425 act.setExpected(actCopyPath, expectedNarSize + doneNarSize);
430 void buildPaths(
const std::vector<DerivedPath> & reqs, BuildMode buildMode)
override;
431 std::vector<KeyedBuildResult>
Definition file-descriptor.hh:265
Definition drv-output-substitution-goal.hh:27
void buildPaths(const std::vector< DerivedPath > &reqs, BuildMode buildMode) override
Definition entry-points.cc:11
void repairPath(const StorePath &path) override
Definition entry-points.cc:40
BuildResult buildDerivation(const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode) override
Definition entry-points.cc:22
void ensurePath(const StorePath &path) override
Definition entry-points.cc:27
std::vector< KeyedBuildResult > buildPathsWithResults(const std::vector< DerivedPath > &reqs, BuildMode buildMode) override
Definition entry-points.cc:17
Definition substitution-goal.hh:14
Definition store-api.hh:397
std::shared_ptr< DerivationResolutionGoal > makeDerivationResolutionGoal(const StorePath &drvPath, ref< const Derivation > drv, BuildMode buildMode)
Definition worker.cc:108
void ensurePath(const StorePath &path) override
Definition entry-points.cc:129
std::vector< KeyedBuildResult > buildPathsWithResults(const std::vector< DerivedPath > &reqs, BuildMode buildMode) override
Definition entry-points.cc:81
size_t getNrLocalBuilds()
Definition worker.cc:185
void childStarted(GoalPtr goal, const std::set< MuxablePipePollState::CommChannel > &channels, bool inBuildSlot, bool respectTimeouts)
Definition worker.cc:195
GoalPtr makeGoal(const DerivedPath &req, BuildMode buildMode=bmNormal)
Definition worker.cc:130
std::shared_ptr< DerivationBuildingGoal > makeDerivationBuildingGoal(const StorePath &drvPath, ref< const BasicDerivation > drv, BuildMode buildMode)
Definition worker.cc:114
void wakeUp(GoalPtr goal)
Definition worker.cc:179
std::weak_ptr< Waker > getCrossThreadWaker()
Definition worker.cc:520
void childTerminated(Goal *goal)
Definition worker.cc:222
void waitForCompletion(GoalPtr goal)
Definition worker.cc:277
bool pathContentsGood(const StorePath &path)
Definition worker.cc:553
BuildResult buildDerivation(const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode) override
Definition entry-points.cc:113
void run(const Goals &topGoals)
Definition worker.cc:283
void removeGoal(GoalPtr goal)
Definition worker.cc:144
std::shared_ptr< PathSubstitutionGoal > makePathSubstitutionGoal(const StorePath &storePath, RepairFlag repair=NoRepair, std::optional< ContentAddress > ca=std::nullopt)
Definition worker.cc:120
void waitForInput()
Definition worker.cc:375
void waitForAWhile(GoalPtr goal)
Definition worker.cc:271
void repairPath(const StorePath &path) override
Definition entry-points.cc:147
ExitStatusFlags exitStatusFlags
Definition worker.hh:230
void buildPaths(const std::vector< DerivedPath > &reqs, BuildMode buildMode) override
Definition entry-points.cc:45
bool tryBuildHook
Definition worker.hh:271
void waitForBuildSlot(GoalPtr goal)
Definition worker.cc:254
fun< std::list< ref< Store > >()> getSubstituters
Definition worker.hh:247
size_t getNrSubstitutions()
Definition worker.cc:190
int Descriptor
Definition file-descriptor.hh:36
JobCategory
Definition goal.hh:57
std::shared_ptr< Goal > GoalPtr
Definition goal.hh:32
std::set< GoalPtr, CompareGoalPtrs > Goals
Definition goal.hh:43
std::string OutputName
Definition outputs-spec.hh:18
Definition logging.hh:221
Definition build-result.hh:123
steady_time_point lastOutput
Definition worker.hh:63
Definition derivation-building-goal.hh:33
Definition derivation-goal.hh:34
Definition derivation-resolution-goal.hh:37
Definition derivation-trampoline-goal.hh:86
Definition derived-path-map.hh:32
Definition derived-path.hh:238
Definition realisation.hh:26
Definition build-result.hh:222
Definition hook-instance.hh:22
Definition outputs-spec.hh:27
Definition worker-settings.hh:27
Definition file-descriptor.hh:377