1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Move machineName from DerivationBuildingGoal to HookInstance

Exactly why is is correct is a little subtle, because sometimes the
worker is owned by the worker. But the commit message in
e437b08250 explained the situation well
enough: I made that commit message part of the ABI docs, and now it
should be understandable to the next person.
This commit is contained in:
John Ericson 2025-08-29 15:49:58 -04:00
parent eb56b181ae
commit 450633aa8c
3 changed files with 20 additions and 8 deletions

View file

@ -7,6 +7,14 @@
namespace nix {
/**
* @note Sometimes this is owned by the `Worker`, and sometimes it is
* owned by a `Goal`. This is for efficiency: rather than starting the
* hook every time we want to ask whether we can run a remote build
* (which can be very often), we reuse a hook process for answering
* those queries until it accepts a build. So if there are N
* derivations to be built, at most N hooks will be started.
*/
struct HookInstance
{
/**
@ -29,6 +37,15 @@ struct HookInstance
*/
Pid pid;
/**
* The remote machine on which we're building.
*
* @Invariant When the hook instance is owned by the `Worker`, this
* is the empty string. When it is owned by a `Goal`, this should be
* set.
*/
std::string machineName;
FdSink sink;
std::map<ActivityId, Activity> activities;