libstore: don't use parseDump to discard nars
this is a step towards using nar parser visitors only where we need nar parser visitors. the performance impact of this should be insignificant and perhaps slightly positive since we no longer allocate anything when discarding a file member. mostly it is a step towards a NARParseVisitor that has no default behavior; we have only three implementations total, and most of them don ot even *use* most of the default implementations. Change-Id: I3466d2a77500778eb152f56ebd441cf1be223dc6
This commit is contained in:
@@ -1216,9 +1216,9 @@ try {
|
||||
bool narRead = false;
|
||||
Finally cleanup = [&]() {
|
||||
if (!narRead) {
|
||||
NARParseVisitor sink;
|
||||
try {
|
||||
parseDump(sink, source);
|
||||
auto copy = copyNAR(source);
|
||||
while (copy.next()) {}
|
||||
} catch (...) {
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
|
||||
@@ -461,14 +461,14 @@ try {
|
||||
information to narSink. */
|
||||
TeeSource tapped { fileSource, narSink };
|
||||
|
||||
NARParseVisitor blank;
|
||||
auto & parseSink = method == FileIngestionMethod::Flat
|
||||
? fileSink
|
||||
: blank;
|
||||
|
||||
/* The information that flows from tapped (besides being replicated in
|
||||
narSink), is now put in parseSink. */
|
||||
parseDump(parseSink, tapped);
|
||||
// the information flows from tapped into narSink. we only check that the
|
||||
// nar is correct, and during flat ingestion contains only a single file.
|
||||
if (method == FileIngestionMethod::Flat) {
|
||||
parseDump(fileSink, tapped);
|
||||
} else {
|
||||
auto copy = copyNAR(tapped);
|
||||
while (copy.next()) {}
|
||||
}
|
||||
|
||||
/* We extract the result of the computation from the sink by calling
|
||||
finish. */
|
||||
|
||||
Reference in New Issue
Block a user