Nix daemon stream old wopAddToStore

No more buffering in string.
This commit is contained in:
John Ericson 2021-11-30 20:53:10 +00:00
parent 1a9bfdc4ca
commit 70a717f7a8

View file

@ -431,7 +431,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
hashAlgo = parseHashType(hashAlgoRaw);
}
StringSink saved;
auto dumpSource = sinkToSource([&](Sink & saved) {
TeeSource savedNARSource(from, saved);
RetrieveRegularNARSink savedRegular { saved };
@ -444,12 +444,10 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
} else
parseDump(savedRegular, from);
logger->startWork();
if (!savedRegular.regular) throw Error("regular file expected");
// FIXME: try to stream directly from `from`.
StringSource dumpSource { *saved.s };
auto path = store->addToStoreFromDump(dumpSource, baseName, method, hashAlgo);
});
logger->startWork();
auto path = store->addToStoreFromDump(*dumpSource, baseName, method, hashAlgo);
logger->stopWork();
to << store->printStorePath(path);