aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/derivation-goal.hh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-08-14 11:55:58 +0200
committereldritch horrors <pennae@lix.systems>2024-08-19 09:13:44 +0000
commitfca523d66126ea1df7c3eda9ab1a2c9b7b1c7ba5 (patch)
treed50f79bbf56b23b0593c5c619085e69cd5900969 /src/libstore/build/derivation-goal.hh
parent5e9db0976158e6990c99fe3cb1b2ec0bd41d7d28 (diff)
libstore: turn HookReply into a variant type
we'll need this once we want to pass extra information out of accepting replies, such as fd sets or possibly even async output reader promises. Change-Id: I5e2f18cdb80b0d2faf3067703cc18bd263329b3f
Diffstat (limited to 'src/libstore/build/derivation-goal.hh')
-rw-r--r--src/libstore/build/derivation-goal.hh14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstore/build/derivation-goal.hh b/src/libstore/build/derivation-goal.hh
index da935ceb5..f7d86ed2e 100644
--- a/src/libstore/build/derivation-goal.hh
+++ b/src/libstore/build/derivation-goal.hh
@@ -14,7 +14,19 @@ using std::map;
struct HookInstance;
-typedef enum {rpAccept, rpDecline, rpPostpone} HookReply;
+struct HookReplyBase {
+ struct [[nodiscard]] Accept {};
+ struct [[nodiscard]] Decline {};
+ struct [[nodiscard]] Postpone {};
+};
+
+struct [[nodiscard]] HookReply
+ : HookReplyBase,
+ std::variant<HookReplyBase::Accept, HookReplyBase::Decline, HookReplyBase::Postpone>
+{
+ HookReply() = delete;
+ using variant::variant;
+};
/**
* Unless we are repairing, we don't both to test validity and just assume it,