aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/worker.hh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-09-25 23:57:46 +0200
committereldritch horrors <pennae@lix.systems>2024-09-29 15:07:30 +0000
commit47ddd119333ab2e7d0c24fb947d99062a79290b9 (patch)
tree4d849caff70b35baf6d57349b6c5389193fff48c /src/libstore/build/worker.hh
parent7f4f86795cc4215d0b8906d2203976768c5f7b21 (diff)
libstore: extract a real makeGoalCommon
makeDerivationGoalCommon had the right idea, but it didn't quite go far enough. let's do the rest and remove the remaining factory duplication. Change-Id: I1fe32446bdfb501e81df56226fd962f85720725b
Diffstat (limited to 'src/libstore/build/worker.hh')
-rw-r--r--src/libstore/build/worker.hh11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstore/build/worker.hh b/src/libstore/build/worker.hh
index 097e73cf7..1953bbec1 100644
--- a/src/libstore/build/worker.hh
+++ b/src/libstore/build/worker.hh
@@ -2,6 +2,7 @@
///@file
#include "async-semaphore.hh"
+#include "concepts.hh"
#include "notifying-counter.hh"
#include "types.hh"
#include "lock.hh"
@@ -240,9 +241,13 @@ public:
* @ref DerivationGoal "derivation goal"
*/
private:
- std::pair<std::shared_ptr<DerivationGoal>, kj::Promise<void>> makeDerivationGoalCommon(
- const StorePath & drvPath, const OutputsSpec & wantedOutputs,
- std::function<std::unique_ptr<DerivationGoal>()> mkDrvGoal);
+ template<typename ID, std::derived_from<Goal> G>
+ std::pair<std::shared_ptr<G>, kj::Promise<void>> makeGoalCommon(
+ std::map<ID, CachedGoal<G>> & map,
+ const ID & key,
+ InvocableR<std::unique_ptr<G>> auto create,
+ std::invocable<G &> auto modify
+ );
std::pair<std::shared_ptr<DerivationGoal>, kj::Promise<void>> makeDerivationGoal(
const StorePath & drvPath,
const OutputsSpec & wantedOutputs, BuildMode buildMode = bmNormal) override;