diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-07-13 17:30:42 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-07-13 17:30:42 +0200 |
commit | 0a9da00a10fa27a3e3b98439cb0a7d5e79135b58 (patch) | |
tree | 34057b575b3a5e5d6c556bff73e6dc5960229aee /src/libstore/daemon.cc | |
parent | fc84c358d9e55e9ba1d939d8974f6deef629848e (diff) |
NarAccessor: Run in constant memory
Diffstat (limited to 'src/libstore/daemon.cc')
-rw-r--r-- | src/libstore/daemon.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index f05f4739d..536f4e738 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -391,7 +391,8 @@ static void performOp(TunnelLogger * logger, ref<Store> store, } HashType hashAlgo = parseHashType(s); - TeeSource savedNAR(from); + StringSink savedNAR; + TeeSource savedNARSource(from, savedNAR); RetrieveRegularNARSink savedRegular; if (method == FileIngestionMethod::Recursive) { @@ -399,7 +400,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, a string so that we can pass it to addToStoreFromDump(). */ ParseSink sink; /* null sink; just parse the NAR */ - parseDump(sink, savedNAR); + parseDump(sink, savedNARSource); } else parseDump(savedRegular, from); @@ -407,7 +408,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, if (!savedRegular.regular) throw Error("regular file expected"); auto path = store->addToStoreFromDump( - method == FileIngestionMethod::Recursive ? *savedNAR.data : savedRegular.s, + method == FileIngestionMethod::Recursive ? *savedNAR.s : savedRegular.s, baseName, method, hashAlgo); @@ -733,7 +734,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, else { TeeParseSink tee(from); parseDump(tee, tee.source); - saved = std::move(*tee.source.data); + saved = std::move(*tee.saved.s); source = std::make_unique<StringSource>(saved); } |