libstore client: remove remaining dead code

Change-Id: I1764b3878439ff7b20ff64bd4efcf03070bb0e5e
This commit is contained in:
jade 2024-05-24 20:45:06 -06:00
parent c22a7f50cb
commit c1f2733dd6
2 changed files with 30 additions and 73 deletions

View file

@ -456,51 +456,21 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source,
{ {
auto conn(getConnection()); auto conn(getConnection());
if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 18) { conn->to << WorkerProto::Op::AddToStoreNar
conn->to << WorkerProto::Op::ImportPaths; << printStorePath(info.path)
<< (info.deriver ? printStorePath(*info.deriver) : "")
<< info.narHash.to_string(Base16, false);
WorkerProto::write(*this, *conn, info.references);
conn->to << info.registrationTime << info.narSize
<< info.ultimate << info.sigs << renderContentAddress(info.ca)
<< repair << !checkSigs;
auto source2 = sinkToSource([&](Sink & sink) { if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 23) {
sink << 1 // == path follows conn.withFramedSink([&](Sink & sink) {
;
copyNAR(source, sink); copyNAR(source, sink);
sink
<< exportMagic
<< printStorePath(info.path);
WorkerProto::WriteConn nested { sink, conn->daemonVersion };
WorkerProto::write(*this, nested, info.references);
sink
<< (info.deriver ? printStorePath(*info.deriver) : "")
<< 0 // == no legacy signature
<< 0 // == no path follows
;
}); });
} else {
conn.processStderr(0, source2.get()); conn.processStderr(0, &source);
auto importedPaths = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
assert(importedPaths.size() <= 1);
}
else {
conn->to << WorkerProto::Op::AddToStoreNar
<< printStorePath(info.path)
<< (info.deriver ? printStorePath(*info.deriver) : "")
<< info.narHash.to_string(Base16, false);
WorkerProto::write(*this, *conn, info.references);
conn->to << info.registrationTime << info.narSize
<< info.ultimate << info.sigs << renderContentAddress(info.ca)
<< repair << !checkSigs;
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 23) {
conn.withFramedSink([&](Sink & sink) {
copyNAR(source, sink);
});
} else if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 21) {
conn.processStderr(0, &source);
} else {
copyNAR(source, conn->to);
conn.processStderr(0, nullptr);
}
} }
} }
@ -624,7 +594,6 @@ void RemoteStore::buildPaths(const std::vector<DerivedPath> & drvPaths, BuildMod
auto conn(getConnection()); auto conn(getConnection());
conn->to << WorkerProto::Op::BuildPaths; conn->to << WorkerProto::Op::BuildPaths;
assert(GET_PROTOCOL_MINOR(conn->daemonVersion) >= 13);
WorkerProto::write(*this, *conn, drvPaths); WorkerProto::write(*this, *conn, drvPaths);
conn->to << buildMode; conn->to << buildMode;
conn.processStderr(); conn.processStderr();
@ -817,25 +786,14 @@ void RemoteStore::queryMissing(const std::vector<DerivedPath> & targets,
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown, StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
uint64_t & downloadSize, uint64_t & narSize) uint64_t & downloadSize, uint64_t & narSize)
{ {
{ auto conn(getConnection());
auto conn(getConnection()); conn->to << WorkerProto::Op::QueryMissing;
if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 19) WorkerProto::write(*this, *conn, targets);
// Don't hold the connection handle in the fallback case conn.processStderr();
// to prevent a deadlock. willBuild = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
goto fallback; willSubstitute = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
conn->to << WorkerProto::Op::QueryMissing; unknown = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
WorkerProto::write(*this, *conn, targets); conn->from >> downloadSize >> narSize;
conn.processStderr();
willBuild = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
willSubstitute = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
unknown = WorkerProto::Serialise<StorePathSet>::read(*this, *conn);
conn->from >> downloadSize >> narSize;
return;
}
fallback:
return Store::queryMissing(targets, willBuild, willSubstitute,
unknown, downloadSize, narSize);
} }

View file

@ -165,11 +165,11 @@ UnkeyedValidPathInfo WorkerProto::Serialise<UnkeyedValidPathInfo>::read(const St
if (deriver != "") info.deriver = store.parseStorePath(deriver); if (deriver != "") info.deriver = store.parseStorePath(deriver);
info.references = WorkerProto::Serialise<StorePathSet>::read(store, conn); info.references = WorkerProto::Serialise<StorePathSet>::read(store, conn);
conn.from >> info.registrationTime >> info.narSize; conn.from >> info.registrationTime >> info.narSize;
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
conn.from >> info.ultimate; conn.from >> info.ultimate;
info.sigs = readStrings<StringSet>(conn.from); info.sigs = readStrings<StringSet>(conn.from);
info.ca = ContentAddress::parseOpt(readString(conn.from)); info.ca = ContentAddress::parseOpt(readString(conn.from));
}
return info; return info;
} }
@ -180,12 +180,11 @@ void WorkerProto::Serialise<UnkeyedValidPathInfo>::write(const Store & store, Wr
<< pathInfo.narHash.to_string(Base16, false); << pathInfo.narHash.to_string(Base16, false);
WorkerProto::write(store, conn, pathInfo.references); WorkerProto::write(store, conn, pathInfo.references);
conn.to << pathInfo.registrationTime << pathInfo.narSize; conn.to << pathInfo.registrationTime << pathInfo.narSize;
if (GET_PROTOCOL_MINOR(conn.version) >= 16) {
conn.to conn.to
<< pathInfo.ultimate << pathInfo.ultimate
<< pathInfo.sigs << pathInfo.sigs
<< renderContentAddress(pathInfo.ca); << renderContentAddress(pathInfo.ca);
}
} }
} }