![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
Classes | |
| struct | ChildOutput |
| struct | ChildEOF |
| struct | Suspend |
| struct | WaitForChildEvent |
| class | AwaitableFrame |
| struct | Co |
| class | CoBase |
| struct | AsyncCallback |
| class | AwaitableFrameBase |
| struct | AwaitableFrame< void > |
Public Types | |
| enum | ExitCode { ecSuccess , ecFailed , ecNoSubstituters } |
| using | ChildEvent = std::variant<ChildOutput, ChildEOF, std::unique_ptr<TimedOut>> |
| template<typename T> | |
| using | HandleType = std::coroutine_handle<AwaitableFrame<T>> |
| using | HandleTypeBase = std::coroutine_handle<AwaitableFrameBase> |
Public Member Functions | |
| virtual void | cleanup () |
| Goal (Worker &worker, Co< ExitCode > init) | |
| void | work () |
| void | handleChildOutput (Descriptor fd, std::string_view data) |
| void | handleEOF (Descriptor fd) |
| void | timedOut (TimedOut &&ex) |
| void | trace (std::string_view s) |
| std::string | getName () const |
| virtual std::string | key ()=0 |
| std::string_view | keyCached () & |
| virtual JobCategory | jobCategory () const =0 |
| Hint for the scheduler, which concurrency limit applies. | |
Public Attributes | |
| Worker & | worker |
| WeakGoals | waiters |
| size_t | nrFailed = 0 |
| size_t | nrNoSubstituters = 0 |
| std::string | name |
| std::optional< ExitCode > | exitCode |
| BuildResult | buildResult |
| bool | preserveFailure = false |
Protected Member Functions | |
| Co< void > | await (Goals waitees) |
| Co< void > | waitForAWhile () |
| Co< void > | waitUntilWoken () |
| Co< void > | waitForBuildSlot () |
| Co< void > | yield () |
Protected Attributes | |
| std::optional< CoBase > | top_co |
| std::optional< ExitCode > | finalExitCode |
| using nix::Goal::HandleType = std::coroutine_handle<AwaitableFrame<T>> |
Handle to coroutine using Co and promise_type.
| void nix::Goal::handleChildOutput | ( | Descriptor | fd, |
| std::string_view | data ) |
Called by the worker when data is received from a child process. Stores the event and resumes the coroutine.
| void nix::Goal::handleEOF | ( | Descriptor | fd | ) |
Called by the worker when EOF is received from a child process. Stores the event and resumes the coroutine.
|
pure virtual |
Hint for the scheduler, which concurrency limit applies.
Implemented in nix::DerivationGoal, nix::DerivationTrampolineGoal, nix::DrvOutputSubstitutionGoal, and nix::PathSubstitutionGoal.
|
pure virtual |
Used for comparisons. The order matters a bit for scheduling. We want:
Also, ensure that derivations get processed in order of their name, i.e. a derivation named "aardvark" always comes before "baboon".
Implemented in nix::DerivationGoal, nix::DerivationTrampolineGoal, nix::DrvOutputSubstitutionGoal, and nix::PathSubstitutionGoal.
|
inline |
| void nix::Goal::timedOut | ( | TimedOut && | ex | ) |
Called by the worker when a build times out. Stores the event and resumes the coroutine.
|
protected |
Awaiting on the resulting coroutine yields the goal for several seconds. Used for retrying goals blocked on acquiring lockfiles.
|
protected |
Awaiting on the resulting coroutine yields the goal until it is explicitly woken up via Worker::wakeUp. Wakeup can be queued from another thread via Worker::Waker.
| void nix::Goal::work | ( | ) |
Resume the goal's coroutine. If it ran to completion, finish the goal: record the exit code, notify waiters, and remove it from the worker.
| BuildResult nix::Goal::buildResult |
Build result.
| std::optional<ExitCode> nix::Goal::exitCode |
How the goal finished, once it has: set exactly once, by work. Not set while the goal is still running, or if it never ran or was cancelled.
|
protected |
Where the top-level coroutine's co_return-ed exit code lands, consumed by work once the coroutine has finished.
| std::string nix::Goal::name |
Name of this goal for debugging purposes.
| size_t nix::Goal::nrFailed = 0 |
Number of goals we are/were waiting for that have failed.
| size_t nix::Goal::nrNoSubstituters = 0 |
Number of substitution goals we are/were waiting for that failed because there are no substituters.
| bool nix::Goal::preserveFailure = false |
Hack to say that this goal should not log the failure, but instead keep it around. Set by a waitee which sees itself as the designated continuation of this goal, responsible for reporting its successes or failures.
|
protected |
The coroutine being currently executed. MUST be updated when switching the coroutine being executed. This is used both for memory management and to resume the last coroutine executed. Destroying this should destroy all coroutines created for this goal.
| WeakGoals nix::Goal::waiters |
Goals waiting for this one to finish. Must use weak pointers here to prevent cycles.
| Worker& nix::Goal::worker |
Backlink to the worker.