Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nix::Worker Class Reference

#include <worker.hh>

Public Member Functions

 Worker (Store &store, Store &evalStore)
 
std::shared_ptr< DerivationGoalmakeDerivationGoal (const StorePath &drvPath, const OutputsSpec &wantedOutputs, BuildMode buildMode=bmNormal)
 
std::shared_ptr< DerivationGoalmakeBasicDerivationGoal (const StorePath &drvPath, const BasicDerivation &drv, const OutputsSpec &wantedOutputs, BuildMode buildMode=bmNormal)
 
std::shared_ptr< PathSubstitutionGoalmakePathSubstitutionGoal (const StorePath &storePath, RepairFlag repair=NoRepair, std::optional< ContentAddress > ca=std::nullopt)
 
std::shared_ptr< DrvOutputSubstitutionGoalmakeDrvOutputSubstitutionGoal (const DrvOutput &id, RepairFlag repair=NoRepair, std::optional< ContentAddress > ca=std::nullopt)
 
GoalPtr makeGoal (const DerivedPath &req, BuildMode buildMode=bmNormal)
 
void removeGoal (GoalPtr goal)
 
void wakeUp (GoalPtr goal)
 
size_t getNrLocalBuilds ()
 
size_t getNrSubstitutions ()
 
void childStarted (GoalPtr goal, const std::set< MuxablePipePollState::CommChannel > &channels, bool inBuildSlot, bool respectTimeouts)
 
void childTerminated (Goal *goal, bool wakeSleepers=true)
 
void waitForBuildSlot (GoalPtr goal)
 
void waitForAnyGoal (GoalPtr goal)
 
void waitForAWhile (GoalPtr goal)
 
void run (const Goals &topGoals)
 
void waitForInput ()
 
unsigned int failingExitStatus ()
 
bool pathContentsGood (const StorePath &path)
 
void markContentsGood (const StorePath &path)
 
void updateProgress ()
 

Public Attributes

const Activity act
 
const Activity actDerivations
 
const Activity actSubstitutions
 
bool permanentFailure
 
bool timedOut
 
bool hashMismatch
 
bool checkMismatch
 
Storestore
 
StoreevalStore
 
std::unique_ptr< HookInstance > hook
 
uint64_t expectedBuilds = 0
 
uint64_t doneBuilds = 0
 
uint64_t failedBuilds = 0
 
uint64_t runningBuilds = 0
 
uint64_t expectedSubstitutions = 0
 
uint64_t doneSubstitutions = 0
 
uint64_t failedSubstitutions = 0
 
uint64_t runningSubstitutions = 0
 
uint64_t expectedDownloadSize = 0
 
uint64_t doneDownloadSize = 0
 
uint64_t expectedNarSize = 0
 
uint64_t doneNarSize = 0
 
bool tryBuildHook = true
 

Detailed Description

Coordinates one or more realisations and their interdependencies.

Member Function Documentation

◆ childStarted()

void nix::Worker::childStarted ( GoalPtr goal,
const std::set< MuxablePipePollState::CommChannel > & channels,
bool inBuildSlot,
bool respectTimeouts )

Registers a running child process. inBuildSlot means that the process counts towards the jobs limit.

◆ childTerminated()

void nix::Worker::childTerminated ( Goal * goal,
bool wakeSleepers = true )

Unregisters a running child process. wakeSleepers should be false if there is no sense in waking up goals that are sleeping because they can't run yet (e.g., there is no free build slot, or the hook would still say postpone).

◆ getNrLocalBuilds()

size_t nix::Worker::getNrLocalBuilds ( )

Return the number of local build processes currently running (but not remote builds via the build hook).

◆ getNrSubstitutions()

size_t nix::Worker::getNrSubstitutions ( )

Return the number of substitution processes currently running.

◆ makeGoal()

GoalPtr nix::Worker::makeGoal ( const DerivedPath & req,
BuildMode buildMode = bmNormal )

Make a goal corresponding to the DerivedPath.

It will be a DerivationGoal for a DerivedPath::Built or a SubstitutionGoal for a DerivedPath::Opaque.

◆ makePathSubstitutionGoal()

std::shared_ptr< PathSubstitutionGoal > nix::Worker::makePathSubstitutionGoal ( const StorePath & storePath,
RepairFlag repair = NoRepair,
std::optional< ContentAddress > ca = std::nullopt )

◆ pathContentsGood()

bool nix::Worker::pathContentsGood ( const StorePath & path)

Check whether the given valid path exists and has the right contents.

◆ removeGoal()

void nix::Worker::removeGoal ( GoalPtr goal)

Remove a dead goal.

◆ run()

void nix::Worker::run ( const Goals & topGoals)

Loop until the specified top-level goals have finished.

◆ waitForAnyGoal()

void nix::Worker::waitForAnyGoal ( GoalPtr goal)

Wait for any goal to finish. Pretty indiscriminate way to wait for some resource that some other goal is holding.

◆ waitForAWhile()

void nix::Worker::waitForAWhile ( GoalPtr goal)

Wait for a few seconds and then retry this goal. Used when waiting for a lock held by another process. This kind of polling is inefficient, but POSIX doesn't really provide a way to wait for multiple locks in the main select() loop.

◆ waitForBuildSlot()

void nix::Worker::waitForBuildSlot ( GoalPtr goal)

Put goal to sleep until a build slot becomes available (which might be right away).

◆ waitForInput()

void nix::Worker::waitForInput ( )

Wait for input to become available.

◆ wakeUp()

void nix::Worker::wakeUp ( GoalPtr goal)

Wake up a goal (i.e., there is something for it to do).

Member Data Documentation

◆ checkMismatch

bool nix::Worker::checkMismatch

Set if at least one derivation is not deterministic in check mode.

◆ hashMismatch

bool nix::Worker::hashMismatch

Set if at least one derivation fails with a hash mismatch.

◆ permanentFailure

bool nix::Worker::permanentFailure

Set if at least one derivation had a BuildError (i.e. permanent failure).

◆ timedOut

bool nix::Worker::timedOut

Set if at least one derivation had a timeout.

◆ tryBuildHook

bool nix::Worker::tryBuildHook = true

Whether to ask the build hook if it can build a derivation. If it answers with "decline-permanently", we don't try again.


The documentation for this class was generated from the following files: