From 7ef44660181b5c9743475ea73bc2e87a5f1d318f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 5 Oct 2024 00:38:35 +0200 Subject: libstore: have goals promise WorkResults, not void Change-Id: Idd218ec1572eda84dc47accc0dcd8a954d36f098 --- src/libstore/build/worker.hh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/libstore/build/worker.hh') diff --git a/src/libstore/build/worker.hh b/src/libstore/build/worker.hh index d0bf742c5..78e204b5a 100644 --- a/src/libstore/build/worker.hh +++ b/src/libstore/build/worker.hh @@ -30,10 +30,12 @@ struct HookInstance; class GoalFactory { public: - virtual std::pair, kj::Promise> makeDerivationGoal( + virtual std::pair, kj::Promise>> + makeDerivationGoal( const StorePath & drvPath, const OutputsSpec & wantedOutputs, BuildMode buildMode = bmNormal ) = 0; - virtual std::pair, kj::Promise> makeBasicDerivationGoal( + virtual std::pair, kj::Promise>> + makeBasicDerivationGoal( const StorePath & drvPath, const BasicDerivation & drv, const OutputsSpec & wantedOutputs, @@ -43,13 +45,13 @@ public: /** * @ref SubstitutionGoal "substitution goal" */ - virtual std::pair, kj::Promise> + virtual std::pair, kj::Promise>> makePathSubstitutionGoal( const StorePath & storePath, RepairFlag repair = NoRepair, std::optional ca = std::nullopt ) = 0; - virtual std::pair, kj::Promise> + virtual std::pair, kj::Promise>> makeDrvOutputSubstitutionGoal( const DrvOutput & id, RepairFlag repair = NoRepair, @@ -62,7 +64,7 @@ public: * It will be a `DerivationGoal` for a `DerivedPath::Built` or * a `SubstitutionGoal` for a `DerivedPath::Opaque`. */ - virtual std::pair> + virtual std::pair>> makeGoal(const DerivedPath & req, BuildMode buildMode = bmNormal) = 0; }; @@ -95,12 +97,12 @@ private: struct CachedGoal { std::weak_ptr goal; - kj::Own> promise; - kj::Own> fulfiller; + kj::Own>> promise; + kj::Own>> fulfiller; CachedGoal() { - auto pf = kj::newPromiseAndFulfiller(); + auto pf = kj::newPromiseAndFulfiller>(); promise = kj::heap(pf.promise.fork()); fulfiller = std::move(pf.fulfiller); } @@ -236,29 +238,29 @@ public: */ private: template G> - std::pair, kj::Promise> makeGoalCommon( + std::pair, kj::Promise>> makeGoalCommon( std::map> & map, const ID & key, InvocableR> auto create, InvocableR auto modify ); - std::pair, kj::Promise> makeDerivationGoal( + std::pair, kj::Promise>> makeDerivationGoal( const StorePath & drvPath, const OutputsSpec & wantedOutputs, BuildMode buildMode = bmNormal) override; - std::pair, kj::Promise> makeBasicDerivationGoal( + std::pair, kj::Promise>> makeBasicDerivationGoal( const StorePath & drvPath, const BasicDerivation & drv, const OutputsSpec & wantedOutputs, BuildMode buildMode = bmNormal) override; /** * @ref SubstitutionGoal "substitution goal" */ - std::pair, kj::Promise> + std::pair, kj::Promise>> makePathSubstitutionGoal( const StorePath & storePath, RepairFlag repair = NoRepair, std::optional ca = std::nullopt ) override; - std::pair, kj::Promise> + std::pair, kj::Promise>> makeDrvOutputSubstitutionGoal( const DrvOutput & id, RepairFlag repair = NoRepair, @@ -271,11 +273,11 @@ private: * It will be a `DerivationGoal` for a `DerivedPath::Built` or * a `SubstitutionGoal` for a `DerivedPath::Opaque`. */ - std::pair> + std::pair>> makeGoal(const DerivedPath & req, BuildMode buildMode = bmNormal) override; public: - using Targets = std::map>; + using Targets = std::map>>; /** * Loop until the specified top-level goals have finished. -- cgit v1.2.3