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:
eldritch horrors
2025-02-27 19:52:44 +00:00
parent 0b4912a0fb
commit c6a4cd6e3a
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -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();
}
+8 -8
View File
@@ -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. */