1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

NarAccessor: Run in constant memory

This commit is contained in:
Eelco Dolstra 2020-07-13 17:30:42 +02:00
parent fc84c358d9
commit 0a9da00a10
7 changed files with 57 additions and 37 deletions

View file

@ -77,15 +77,15 @@ StorePaths Store::importPaths(Source & source, std::shared_ptr<FSAccessor> acces
if (deriver != "")
info.deriver = parseStorePath(deriver);
info.narHash = hashString(htSHA256, *tee.source.data);
info.narSize = tee.source.data->size();
info.narHash = hashString(htSHA256, *tee.saved.s);
info.narSize = tee.saved.s->size();
// Ignore optional legacy signature.
if (readInt(source) == 1)
readString(source);
// Can't use underlying source, which would have been exhausted
auto source = StringSource { *tee.source.data };
auto source = StringSource { *tee.saved.s };
addToStore(info, source, NoRepair, checkSigs, accessor);
res.push_back(info.path);