aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/remote-store.cc
AgeCommit message (Collapse)Author
2023-01-11Remove default constructor from `OutputsSpec`John Ericson
This forces us to be explicit. It also requires to rework how `from_json` works. A `JSON_IMPL` is added to assist with this.
2023-01-11Split `OutputsSpec` and `ExtendedOutputsSpec`, use the former moreJohn Ericson
`DerivedPath::Built` and `DerivationGoal` were previously using a regular set with the convention that the empty set means all outputs. But it is easy to forget about this rule when processing those sets. Using `OutputSpec` forces us to get it right.
2023-01-02Fix why-depends for CA derivations (again)Théophane Hufschmitt
This has the same goal as b13fd4c58e81b2b2b0d72caa5ce80de861622610,but achieves it in a different way in order to not break `nix why-depends --derivation`.
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-08-22Merge remote-tracking branch 'origin/master' into parallel-nix-copyEelco Dolstra
2022-08-17Remove warnLargeDump()Eelco Dolstra
This message was unhelpful (#1184) and probably misleading since memory is O(1) in most cases now.
2022-06-08Restore the "low-latency" ssh copyingThéophane Hufschmitt
2022-05-30RemoteStore::queryRealisationUncached(): Fix potential noexcept violationEelco Dolstra
2022-05-04Get rid of most `.at` calls (#6393)Alain Zscheile
Use one of `get` or `getOr` instead which will either return a null-pointer (with a nicer error message) or a default value when the key is missing.
2022-03-09BuildResult: Use DerivedPathEelco Dolstra
2022-03-08Add Store::buildPathsWithResults()Eelco Dolstra
This function is like buildPaths(), except that it returns a vector of BuildResults containing the exact statuses and output paths of each derivation / substitution. This is convenient for functions like Installable::build(), because they then don't need to do another series of calls to get the outputs of CA derivations. It's also a precondition to impure derivations, where we *can't* query the output of those derivations since they're not stored in the Nix database. Note that PathSubstitutionGoal can now also return a BuildStatus.
2022-03-03Factor out a `GcStore` interfaceJohn Ericson
Starts progress on #5729. The idea is that we should not have these default methods throwing "unimplemented". This is a small step in that direction. I kept `addTempRoot` because it is a no-op, rather than failure. Also, as a practical matter, it is called all over the place, while doing other tasks, so the downcasting would be annoying. Maybe in the future I could move the "real" `addTempRoot` to `GcStore`, and the existing usecases use a `tryAddTempRoot` wrapper to downcast or do nothing, but I wasn't sure whether that was a good idea so with a bias to less churn I didn't do it yet.
2022-03-01Move `BuildResult` defintion to its own headerJohn Ericson
Just like we did for `ValidPathInfo` in d92d4f85a5c8a2a2385c084500a8b6bd54b54e6c.
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-16addToStoreFromDump(): Take std::string_viewEelco Dolstra
2022-01-25nix store ping: Report Nix daemon versionEelco Dolstra
Fixes #5952.
2022-01-18Add command 'nix store copy-log'Eelco Dolstra
Fixes #5222.
2022-01-18Get rid of std::shared_ptr<std::string> and ref<std::string>Eelco Dolstra
These were needed back in the pre-C++11 era because we didn't have move semantics. But now we do.
2021-12-22Remove CPU lockingEelco Dolstra
This was already accidentally disabled in ba87b08. It also no longer appears to be beneficial, and in fact slow things down, e.g. when evaluating a NixOS system configuration: elapsed time: median = 3.8170 mean = 3.8202 stddev = 0.0195 min = 3.7894 max = 3.8600 [rejected, p=0.00000, Δ=0.36929±0.02513]
2021-12-07Tweak warningEelco Dolstra
2021-12-06Fallback when the daemon is too old for CA derivationsregnat
Fix #5712
2021-11-16Merge pull request #5472 from NixOS/async-realisation-substitutionEelco Dolstra
async realisation substitution
2021-11-09Merge pull request #5494 from tweag/balsoft/allow-references-in-addPathEelco Dolstra
Allow references in addPath
2021-11-09addToStore, addToStoreFromDump: refactor: pass refs by const referenceAlexander Bantyev
Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
2021-11-05Make the flake options work when using the daemonregnat
When setting flake-local options (with the `nixConfig` field), forward these options to the daemon in case we’re using one. This is necessary in particular for options like `binary-caches` or `post-build-hook` to make sense. Fix <https://github.com/NixOS/nix/commit/343239fc8a1993f707a990c2cd54a41f1fa3de99#r44356843>
2021-11-03Expose an async interface for `queryRealisation`regnat
Doesn’t change much so far because everything is still using it synchronously, but should allow the binary cache to fetch stuff in parallel
2021-10-23addToStore, addToStoreFromDump: add references argumentAlexander Bantyev
Allow to pass a set of references to be added as info to the added paths.
2021-10-13Remove syncWithGC()Eelco Dolstra
2021-09-30`std::visit` by referenceJohn Ericson
I had started the trend of doing `std::visit` by value (because a type error once mislead me into thinking that was the only form that existed). While the optomizer in principle should be able to deal with extra coppying or extra indirection once the lambdas inlined, sticking with by reference is the conventional default. I hope this might even improve performance.
2021-09-23Shut down write side before draining the read sideEelco Dolstra
This is important if the remote side *does* execute nix-store/nix-daemon successfully, but stdout is polluted (e.g. because the remote user's bashrc script prints something to stdout). In that case we have to shutdown the write side to force the remote nix process to exit.
2021-09-23SSHStore / LegacySSHStore: Show a better error message if the remote is ↵Eelco Dolstra
"nologin" Instead of error: serialised integer 7161674624452356180 is too large for type 'j' we now get error: 'nix-store --serve' protocol mismatch from 'sshtest@localhost', got 'This account is currently not available.' Fixes https://github.com/NixOS/nixpkgs/issues/37287.
2021-07-30Don’t send the experimental-features to the daemonregnat
The experimental features are, well, experimental, and shouldn’t be carelessly and transparently enabled. Besides, some (`ca-derivations` at least) need to be enabled at startup in order to work properly. So it’s better to just require that daemon be started with the right `experimental-features` option. Fix #5017
2021-07-26Low-latency closure copyEelco Dolstra
This adds a new store operation 'addMultipleToStore' that reads a number of NARs and ValidPathInfos from a Source, allowing any number of store paths to be copied in a single call. This is much faster on high-latency links when copying a lot of small files, like .drv closures. For example, on a connection with an 50 ms delay: Before: $ nix copy --to 'unix:///tmp/proxy-socket?root=/tmp/dest-chroot' \ /nix/store/90jjw94xiyg5drj70whm9yll6xjj0ca9-hello-2.10.drv \ --derivation --no-check-sigs real 0m57.868s user 0m0.103s sys 0m0.056s After: real 0m0.690s user 0m0.017s sys 0m0.011s
2021-07-22RemoteStore::buildPaths(): Handle evalStoreEelco Dolstra
2021-07-22buildPaths(): Add an evalStore argumentEelco Dolstra
With this, we don't have to copy the entire .drv closure to the destination store ahead of time (or at all). Instead, buildPaths() reads .drv files from the eval store and copies inputSrcs to the destination store if it needs to build a derivation. Issue #5025.
2021-07-22Hacky fast closure copying mechanismEelco Dolstra
2021-05-19Always send the realisations as JSONregnat
Align all the worker protocol with `buildDerivation` which inlines the realisations as one opaque json blob. That way we don’t have to bother changing the remote store protocol when the definition of `Realisation` changes, as long as we keep the json backwards-compatible
2021-05-03Bump version number for `DerivedPath` changesMaximilian Bosch
I guess I misunderstood John's initial explanation about why wildcards for outputs are sent to older stores[1]. My `nix-daemon` from 2021-03-26 also has version 1.29, but misses the wildcard[2]. So bumping seems to be the right call. [1] https://github.com/NixOS/nix/pull/4759#issuecomment-830812464 [2] 255d145ba7ac907d1cba8d088da556b591627756
2021-04-05Rename BuildableJohn Ericson
2021-04-05"newtype" BuildableReqJohn Ericson
This makes for better types errors and allows us to give it methods.
2021-04-05Use `BuildableReq` for `buildPaths` and `ensurePath`John Ericson
This avoids an ambiguity where the `StorePathWithOutputs { drvPath, {} }` could mean "build `brvPath`" or "substitute `drvPath`" depending on context. It also brings the internals closer in line to the new CLI, by generalizing the `Buildable` type is used there and makes that distinction already. In doing so, relegate `StorePathWithOutputs` to being a type just for backwards compatibility (CLI and RPC).
2021-03-22Fix typos in the last PR #4656John Ericson
2021-03-22Clean up serialization for `BuildResult`John Ericson
A few versioning mistakes were corrected: - In 27b5747ca7b5599768083dde5fa4d36bfbb0f66f, Daemon protocol had some version `>= 0xc` that should have been `>= 0x1c`, or `28` since the other conditions used decimal. - In a2b69660a9b326b95d48bd222993c5225bbd5b5f, legacy SSH gated new CAS info on version 6, but version 5 in the server. It is now 6 everywhere. Additionally, legacy ssh was sending over more metadata than the daemon one was. The daemon now sends that data too. CC @regnat Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2021-02-23RemoteStore: Send back the new realisationsregnat
To allow it to build ca derivations remotely
2021-02-23Make the build-hook work with ca derivationsregnat
- Pass it the name of the outputs rather than their output paths (as these don't exist for ca derivations) - Get the built output paths from the remote builder - Register the new received realisations
2020-12-20Overhaul store subclassingJohn Ericson
We embrace virtual the rest of the way, and get rid of the `assert(false)` 0-param constructors. We also list config base classes first, so the constructor order is always: 1. all the configs 2. all the stores Each in the same order
2020-12-11Store metadata about drv outputs realisationsregnat
For each known realisation, store: - its output - its output path This comes with a set of needed changes: - New `realisations` module declaring the types needed for describing these mappings - New `Store::registerDrvOutput` method registering all the needed informations about a derivation output (also replaces `LocalStore::linkDeriverToPath`) - new `Store::queryRealisation` method to retrieve the informations for a derivations This introcudes some redundancy on the remote-store side between `wopQueryDerivationOutputMap` and `wopQueryRealisation`. However we might need to keep both (regardless of backwards compat) because we sometimes need to get some infos for all the outputs of a derivation (where `wopQueryDerivationOutputMap` is handy), but all the stores can't implement it − because listing all the outputs of a derivation isn't really possible for binary caches where the server doesn't allow to list a directory.
2020-12-02read(): Use char * instead of unsigned char *Eelco Dolstra
This gets rid of some pointless casts.
2020-12-02Sink: Use std::string_viewEelco Dolstra
2020-11-17Merge pull request #4180 from Ma27/ssh-ng-substituteEelco Dolstra
Allow substituting paths when building remotely using `ssh-ng://`