aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/daemon.cc7
-rw-r--r--src/libstore/export-import.cc11
-rw-r--r--src/libutil/archive.hh7
3 files changed, 10 insertions, 15 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index e370e278c..b2e37c5b5 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -721,9 +721,10 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
if (GET_PROTOCOL_MINOR(clientVersion) >= 21)
source = std::make_unique<TunnelSource>(from, to);
else {
- TeeSink tee(from);
- parseDump(tee, tee.source);
- saved = std::move(*tee.source.data);
+ TeeSource tee(from);
+ ParseSink sink;
+ parseDump(sink, tee);
+ saved = std::move(*tee.data);
source = std::make_unique<StringSource>(saved);
}
diff --git a/src/libstore/export-import.cc b/src/libstore/export-import.cc
index cb9da027d..0e33fb687 100644
--- a/src/libstore/export-import.cc
+++ b/src/libstore/export-import.cc
@@ -77,8 +77,9 @@ StorePaths Store::importPaths(Source & source, std::shared_ptr<FSAccessor> acces
if (n != 1) throw Error("input doesn't look like something created by 'nix-store --export'");
/* Extract the NAR from the source. */
- TeeSink tee(source);
- parseDump(tee, tee.source);
+ TeeSource tee(source);
+ ParseSink sink;
+ parseDump(sink, tee);
uint32_t magic = readInt(source);
if (magic != exportMagic)
@@ -94,15 +95,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.data);
+ info.narSize = tee.data->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.data };
addToStore(info, source, NoRepair, checkSigs, accessor);
res.push_back(info.path);
diff --git a/src/libutil/archive.hh b/src/libutil/archive.hh
index 768fe2536..32d98a610 100644
--- a/src/libutil/archive.hh
+++ b/src/libutil/archive.hh
@@ -63,13 +63,6 @@ struct ParseSink
virtual void createSymlink(const Path & path, const string & target) { };
};
-struct TeeSink : ParseSink
-{
- TeeSource source;
-
- TeeSink(Source & source) : source(source) { }
-};
-
void parseDump(ParseSink & sink, Source & source);
void restorePath(const Path & path, Source & source);