aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/worker-protocol.hh
AgeCommit message (Collapse)Author
2020-08-05Solve template deduction problemCarlo Nucera
We had to predeclare our template functions
2020-08-05WIP: Put the worker protocol `read` and `write` in a namespace to disambigJohn Ericson
2020-08-05Proxy -> Phantom to match RustJohn Ericson
Sorry, Haskell.
2020-08-04Remove unused functionsJohn Ericson
2020-08-04WIP systematize more of the worker protocolJohn Ericson
This refactor should *not* change the wire protocol.
2020-07-31Merge branch 'master' of github.com:NixOS/nix into drv-outputs-map-allow-missingCarlo Nucera
2020-07-30Merge remote-tracking branch 'origin/master' into substitute-other-storedirMatthew Bauer
2020-07-29Fix RemoteStore::addToStore() latencyEelco Dolstra
Since 6185d25e523a3cd223dd6f6aca10cf6ff15b4823, this was very latency-bound since it required a round-trip for every 32 KiB. So for example copying a 514 MiB closure over a virtual ethernet device with a articial delay of just 1 ms took 343s. Now it takes 2.7s. Fixes #3372.
2020-07-24`queryDerivationOutputMap` no longer assumes all outputs have a mappingJohn Ericson
This assumption is broken by CA derivations. Making a PR now to do the breaking daemon change as soon as possible (if it is already too late, we can bump protocol intead).
2020-07-02Merge remote-tracking branch 'origin/master' into substitute-other-storedirMatthew Bauer
2020-06-24Add a way to get all the outputs of a derivation with their labelregnat
Generalize `queryDerivationOutputNames` and `queryDerivationOutputs` by adding a `queryDerivationOutputMap` that returns the map `outputName=>outputPath` (not that this is not equivalent to merging the results of `queryDerivationOutputs` and `queryDerivationOutputNames` as sets don't preserve the order, so we would end up with an incorrect mapping). squash! Add a way to get all the outputs of a derivation with their label Rename StorePathMap to OutputPathMap
2020-06-22Merge remote-tracking branch 'origin/master' into substitute-other-storedirMatthew Bauer
2020-06-19Update worker protocol to support sending storepath mapsMatthew Bauer
We need to also send the ca to daemon in addition to the path.
2020-06-12Remove Store::queryDerivationOutputNames()Eelco Dolstra
This function was used in only one place, where it could easily be replaced by readDerivation() since it's not performance-critical. (This function appears to have been modelled after queryDerivationOutputs(), which exists only to make the garbage collector faster.)
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2019-10-30minor: fix mismatch of struct/class forward decl of 'Source'Will Dietz
Fixes the following warning and the indicate potential issue: src/libstore/worker-protocol.hh:66:1: warning: class 'Source' was previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags] (cherry picked from commit 6e1bb04870b1b723282d32182af286646f13bf3c)
2019-10-29Move most of the daemon implementation to libstoreEelco Dolstra
2018-05-30Make 'nix copy --to daemon' run in constant memory (daemon side)Eelco Dolstra
Continuation of 97002b684c902dadcd351a67208f9c2a88ff8f8f. This makes the daemon use constant memory. For example, it reduces the daemon's maximum RSS on $ nix copy --from ~/my-nix --to daemon /nix/store/1n7x0yv8vq6zi90hfmian84vdhd04bgp-blender-2.79a from 264 MiB to 7 MiB. We now use a TunnelSource to prevent the connection from ending up in an undefined state if an exception is thrown while the NAR is being sent. Issue https://github.com/NixOS/nix/issues/1681.
2017-08-28Don't send progress messages to older clientsEelco Dolstra
2017-08-28Tunnel progress messages from the daemon to the clientEelco Dolstra
This makes the progress bar work for non-root users.
2017-04-06Implement RemoteStore::queryMissing()Eelco Dolstra
This provides a significant speedup, e.g. 64 s -> 12 s for nix-build --dry-run -I nixpkgs=channel:nixos-16.03 '<nixpkgs/nixos/tests/misc.nix>' -A test on a cold local and CloudFront cache. The alternative is to use lots of concurrent daemon connections but that seems wasteful.
2016-11-09Merge branch 'ssh-store' of https://github.com/shlevy/nixEelco Dolstra
2016-09-02Implement nar-based addToStore for remote-storeShea Levy
2016-09-02Add narFromPath op to nix daemonShea Levy
2016-06-01Make the store directory a member variable of StoreEelco Dolstra
2016-05-04Add a Store::addToStore() variant that accepts a NAREelco Dolstra
As a side effect, this ensures that signatures are propagated when copying paths between stores. Also refactored import/export to make use of this.
2016-04-20RemoteStore: Propagate InvalidPath exceptions from the daemonEelco Dolstra
2016-04-19Move path info caching from BinaryCacheStore to StoreEelco Dolstra
Caching path info is generally useful. For instance, it speeds up "nix path-info -rS /run/current-system" (i.e. showing the closure sizes of all paths in the closure of the current system) from 5.6s to 0.15s. This also eliminates some APIs like Store::queryDeriver() and Store::queryReferences().
2016-04-05Add "nix copy-sigs" commandEelco Dolstra
This imports signatures from one store into another. E.g. $ nix copy-sigs -r /run/current-system -s https://cache.nixos.org/ imported 595 signatures
2016-03-30LocalStore: Keep track of ultimately trusted pathsEelco Dolstra
These are content-addressed paths or outputs of locally performed builds. They are trusted even if they don't have signatures, so "nix verify-paths" won't complain about them.
2015-12-02daemon: Add 'buildMode' parameter to 'buildPaths' RPCLudovic Courtès
2015-09-03Implement buildDerivation() via the daemonEelco Dolstra
2015-06-02Add a ‘verifyStore’ RPCLudovic Courtès
Hello! The patch below adds a ‘verifyStore’ RPC with the same signature as the current LocalStore::verifyStore method. Thanks, Ludo’. >From aef46c03ca77eb6344f4892672eb6d9d06432041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org> Date: Mon, 1 Jun 2015 23:17:10 +0200 Subject: [PATCH] Add a 'verifyStore' remote procedure call.
2014-09-01Add an 'optimiseStore' remote procedure call.Ludovic Courtès
2014-07-24Remove some dead codeEelco Dolstra
2013-08-07Run the daemon worker on the same CPU as the clientEelco Dolstra
On a system with multiple CPUs, running Nix operations through the daemon is significantly slower than "direct" mode: $ NIX_REMOTE= nix-instantiate '<nixos>' -A system real 0m0.974s user 0m0.875s sys 0m0.088s $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m2.118s user 0m1.463s sys 0m0.218s The main reason seems to be that the client and the worker get moved to a different CPU after every call to the worker. This patch adds a hack to lock them to the same CPU. With this, the overhead of going through the daemon is very small: $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m1.074s user 0m0.809s sys 0m0.098s
2013-03-08Revert "Prevent config.h from being clobbered"Eelco Dolstra
This reverts commit 28bba8c44f484eae38e8a15dcec73cfa999156f6.
2013-03-07Prevent config.h from being clobberedEelco Dolstra
2013-02-19Add `Settings::nixDaemonSocketFile'.Ludovic Courtès
2012-12-20nix-store -q --roots: Respect the gc-keep-outputs/gc-keep-derivations settingsEelco Dolstra
So if a path is not garbage solely because it's reachable from a root due to the gc-keep-outputs or gc-keep-derivations settings, ‘nix-store -q --roots’ now shows that root.
2012-07-30WhitespaceEelco Dolstra
2012-07-26Merge branch 'master' into no-manifestsEelco Dolstra
2012-07-18Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra
2012-07-18Merge branch 'master' into no-manifestsEelco Dolstra
2012-07-17Add function queryPathFromHashPart()Eelco Dolstra
To implement binary caches efficiently, Hydra needs to be able to map the hash part of a store path (e.g. "gbg...zr7") to the full store path (e.g. "/nix/store/gbg...kzr7-subversion-1.7.5"). (The binary cache mechanism uses hash parts as a key for looking up store paths to ensure privacy.) However, doing a search in the Nix store for /nix/store/<hash>* is expensive since it requires reading the entire directory. queryPathFromHashPart() prevents this by doing a cheap database lookup.
2012-07-11Replace hasSubstitutes() with querySubstitutablePaths()Eelco Dolstra
querySubstitutablePaths() takes a set of paths, so this greatly reduces daemon <-> client latency.
2012-07-11Add a function queryValidPaths()Eelco Dolstra
queryValidPaths() combines multiple calls to isValidPath() in one. This matters when using the Nix daemon because it reduces latency. For instance, on "nix-env -qas \*" it reduces execution time from 5.7s to 4.7s (which is indistinguishable from the non-daemon case).
2012-07-11Rename queryValidPaths() to queryAllValidPaths()Eelco Dolstra
2012-07-11Implement querySubstitutablePathInfos() in the daemonEelco Dolstra
Also removed querySubstitutablePathInfo().
2012-06-27nix-store -r: do substitutions in parallelEelco Dolstra
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.