aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-binary-cache-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-13 20:07:19 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-13 20:07:19 +0200
commit7c2fef0a819481058d49c469c115bb0668b7016b (patch)
tree527d061e600b23d6922a4daf6609bc247e992186 /src/libstore/local-binary-cache-store.cc
parent493961b6899e7f3471e7efa24ed251c7723adbcd (diff)
Make 'nix copy' to s3:// binary caches run in constant memory
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r--src/libstore/local-binary-cache-store.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index 3d531d3a7..87d8334d7 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -31,12 +31,13 @@ protected:
bool fileExists(const std::string & path) override;
void upsertFile(const std::string & path,
- Source & source,
- const std::string & mimeType)
+ std::shared_ptr<std::basic_iostream<char>> istream,
+ const std::string & mimeType) override
{
auto path2 = binaryCacheDir + "/" + path;
Path tmp = path2 + ".tmp." + std::to_string(getpid());
AutoDelete del(tmp, false);
+ StreamToSourceAdapter source(istream);
writeFile(tmp, source);
if (rename(tmp.c_str(), path2.c_str()))
throw SysError("renaming '%1%' to '%2%'", tmp, path2);