Eliminate old TeeSink abstraction

This was introduced in fa125b9b28, and
then "reverted" in 1cf4801108, except that
revert left the struct around doing nothing useful.

We're removing it all the way now because we want to make a new
`TeeSink` complementing the already-exiting `TeeSource`, that is
actually a completely different concept as far as the class hierarchy is
concerned.
This commit is contained in:
Carlo Nucera 2020-06-16 12:45:36 -04:00 committed by John Ericson
parent 3078404e35
commit fb05a6adcf
3 changed files with 10 additions and 15 deletions

View file

@ -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);
}

View file

@ -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);

View file

@ -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);