diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-08-03T19·10+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-08-03T19·21+0200 |
commit | 2825e05d21ecabc8b8524836baf0b9b05da993c6 (patch) | |
tree | dbdfb391c835dc4baebee804653bbf7e399b6b27 /src/nix-daemon/nix-daemon.cc | |
parent | 34c17fdae535d0128d178dde676f56f1bc8439e3 (diff) |
Make adding paths via nix-store --serve run in constant memory
It adds a new operation, cmdAddToStoreNar, that does the same thing as the corresponding nix-daemon operation, i.e. call addToStore(). This replaces cmdImportPaths, which has the major issue that it sends the NAR first and the store path second, thus requiring us to store the incoming NAR either in memory or on disk until we decide what to do with it. For example, this reduces the memory usage of $ nix copy --to 'ssh://localhost?remote-store=/tmp/nix' /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 267 MiB to 12 MiB. Probably fixes #1988.
Diffstat (limited to 'src/nix-daemon/nix-daemon.cc')
-rw-r--r-- | src/nix-daemon/nix-daemon.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index a2e54b93c05f..644fa6681de3 100644 --- a/src/nix-daemon/nix-daemon.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -707,6 +707,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, logger->startWork(); + // FIXME: race if addToStore doesn't read source? store.cast<Store>()->addToStore(info, *source, (RepairFlag) repair, dontCheckSigs ? NoCheckSigs : CheckSigs, nullptr); |