aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/goal.hh
diff options
context:
space:
mode:
authorMatej Urbas <matej.urbas@gmail.com>2023-05-08 19:45:46 +0100
committerMatej Urbas <matej.urbas@gmail.com>2023-05-08 19:45:46 +0100
commit13185133bcdff751274e55bf29b80b4e600cd973 (patch)
tree878720d15ad41970c720d27d6bbdada6ab78a2fd /src/libstore/build/goal.hh
parent1ea1e378de22bf32b5ccc1edf66798ab91299ac7 (diff)
introduces `Goal::jobCategory`
Diffstat (limited to 'src/libstore/build/goal.hh')
-rw-r--r--src/libstore/build/goal.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh
index c0e12a2ed..a313bf22c 100644
--- a/src/libstore/build/goal.hh
+++ b/src/libstore/build/goal.hh
@@ -34,6 +34,17 @@ typedef std::set<WeakGoalPtr, std::owner_less<WeakGoalPtr>> WeakGoals;
*/
typedef std::map<StorePath, WeakGoalPtr> WeakGoalMap;
+/**
+ * Used as a hint to the worker on how to schedule a particular goal. For example,
+ * builds are typically CPU- and memory-bound, while substitutions are I/O bound.
+ * Using this information, the worker might decide to schedule more or fewer goals
+ * of each category in parallel.
+ */
+enum struct JobCategory {
+ Build,
+ Substitution,
+};
+
struct Goal : public std::enable_shared_from_this<Goal>
{
typedef enum {ecBusy, ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode;
@@ -150,6 +161,8 @@ public:
void amDone(ExitCode result, std::optional<Error> ex = {});
virtual void cleanup() { }
+
+ virtual JobCategory jobCategory() = 0;
};
void addToWeakGoals(WeakGoals & goals, GoalPtr p);