aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/derivation-goal.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build/derivation-goal.hh')
-rw-r--r--src/libstore/build/derivation-goal.hh35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/libstore/build/derivation-goal.hh b/src/libstore/build/derivation-goal.hh
index 7505409c0..6dd58afd2 100644
--- a/src/libstore/build/derivation-goal.hh
+++ b/src/libstore/build/derivation-goal.hh
@@ -18,7 +18,7 @@ struct HookInstance;
struct HookReplyBase {
struct [[nodiscard]] Accept {
- kj::Promise<Outcome<void, Goal::Finished>> promise;
+ kj::Promise<Outcome<void, Goal::WorkResult>> promise;
};
struct [[nodiscard]] Decline {};
struct [[nodiscard]] Postpone {};
@@ -63,7 +63,7 @@ struct InitialOutputStatus {
struct InitialOutput {
bool wanted;
Hash outputHash;
- std::optional<InitialOutputStatus> known;
+ std::optional<InitialOutputStatus> known = {};
};
/**
@@ -74,6 +74,12 @@ struct DerivationGoal : public Goal
struct InputStream;
/**
+ * Whether this goal has completed. Completed goals can not be
+ * asked for more outputs, a new goal must be created instead.
+ */
+ bool isDone = false;
+
+ /**
* Whether to use an on-disk .drv file.
*/
bool useDerivation;
@@ -179,6 +185,11 @@ struct DerivationGoal : public Goal
std::map<std::string, InitialOutput> initialOutputs;
/**
+ * Build result.
+ */
+ BuildResult buildResult;
+
+ /**
* File descriptor for the log file.
*/
AutoCloseFD fdLogFile;
@@ -242,14 +253,14 @@ struct DerivationGoal : public Goal
BuildMode buildMode = bmNormal);
virtual ~DerivationGoal() noexcept(false);
- Finished timedOut(Error && ex);
+ WorkResult timedOut(Error && ex);
- kj::Promise<Result<WorkResult>> work() noexcept override;
+ kj::Promise<Result<WorkResult>> workImpl() noexcept override;
/**
* Add wanted outputs to an already existing derivation goal.
*/
- void addWantedOutputs(const OutputsSpec & outputs);
+ bool addWantedOutputs(const OutputsSpec & outputs);
/**
* The states.
@@ -313,13 +324,13 @@ struct DerivationGoal : public Goal
protected:
kj::TimePoint lastChildActivity = kj::minValue;
- kj::Promise<Outcome<void, Finished>> handleChildOutput() noexcept;
- kj::Promise<Outcome<void, Finished>>
+ kj::Promise<Outcome<void, WorkResult>> handleChildOutput() noexcept;
+ kj::Promise<Outcome<void, WorkResult>>
handleChildStreams(InputStream & builderIn, InputStream * hookIn) noexcept;
- kj::Promise<Outcome<void, Finished>> handleBuilderOutput(InputStream & in) noexcept;
- kj::Promise<Outcome<void, Finished>> handleHookOutput(InputStream & in) noexcept;
- kj::Promise<Outcome<void, Finished>> monitorForSilence() noexcept;
- Finished tooMuchLogs();
+ kj::Promise<Outcome<void, WorkResult>> handleBuilderOutput(InputStream & in) noexcept;
+ kj::Promise<Outcome<void, WorkResult>> handleHookOutput(InputStream & in) noexcept;
+ kj::Promise<Outcome<void, WorkResult>> monitorForSilence() noexcept;
+ WorkResult tooMuchLogs();
void flushLine();
public:
@@ -354,7 +365,7 @@ public:
void started();
- Finished done(
+ WorkResult done(
BuildResult::Status status,
SingleDrvOutputs builtOutputs = {},
std::optional<Error> ex = {});