From 869666cb651f97cdce3a6aabf62073bfe1130cbb Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 29 Aug 2024 21:06:30 +0200 Subject: libstore: hide Worker goal factory methods this doesn't serve a great purpose yet except to confine construction of goals to the stack frame of Worker::run() and its child frames. we don't need this yet (and the goal constructors remain fully visible), but in a future change that fully removes the current worker loop we'll need some way of knowing which goals are top-level goals without passing the goals themselves around. once that's possible we can remove visible goals as a concept and rely on build result futures and a scheduler built upon them Change-Id: Ia73cdeffcfb9ba1ce9d69b702dc0bc637a4c4ce6 --- src/libstore/build/worker.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libstore/build/worker.cc') diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 9e548cc16..5d0cc920a 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -326,8 +326,9 @@ void Worker::waitForAWhile(GoalPtr goal) } -void Worker::run(const Goals & _topGoals) +Goals Worker::run(std::function req) { + auto _topGoals = req(goalFactory()); std::vector topPaths; assert(!running); @@ -411,6 +412,8 @@ void Worker::run(const Goals & _topGoals) assert(!settings.keepGoing || awake.empty()); assert(!settings.keepGoing || wantingToBuild.empty()); assert(!settings.keepGoing || children.empty()); + + return _topGoals; } void Worker::waitForInput() -- cgit v1.2.3