aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build/derivation-goal.cc6
-rw-r--r--src/libstore/common-protocol.hh1
-rw-r--r--src/libstore/daemon.cc38
-rw-r--r--src/libstore/derivations.cc2
-rw-r--r--src/libstore/export-import.cc2
-rw-r--r--src/libstore/legacy-ssh-store.cc1
-rw-r--r--src/libstore/remote-store-connection.hh2
-rw-r--r--src/libstore/remote-store.cc2
-rw-r--r--src/libstore/serve-protocol-impl.hh2
-rw-r--r--src/libstore/serve-protocol.hh1
-rw-r--r--src/libstore/worker-protocol-impl.hh2
-rw-r--r--src/libstore/worker-protocol.hh3
-rw-r--r--src/nix-store/nix-store.cc9
-rw-r--r--tests/unit/libstore/common-protocol.cc2
-rw-r--r--tests/unit/libstore/protocol.hh2
15 files changed, 34 insertions, 41 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index a97c32599..ef16cd011 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -1204,11 +1204,9 @@ HookReply DerivationGoal::tryBuildHook()
throw;
}
- CommonProto::WriteConn conn { hook->sink };
-
/* Tell the hook all the inputs that have to be copied to the
remote system. */
- conn.to << CommonProto::write(worker.store, conn, inputPaths);
+ hook->sink << CommonProto::write(worker.store, {}, inputPaths);
/* Tell the hooks the missing outputs that have to be copied back
from the remote system. */
@@ -1219,7 +1217,7 @@ HookReply DerivationGoal::tryBuildHook()
if (buildMode != bmCheck && status.known && status.known->isValid()) continue;
missingOutputs.insert(outputName);
}
- conn.to << CommonProto::write(worker.store, conn, missingOutputs);
+ hook->sink << CommonProto::write(worker.store, {}, missingOutputs);
}
hook->sink = FdSink();
diff --git a/src/libstore/common-protocol.hh b/src/libstore/common-protocol.hh
index 7f9f2808a..2118ca5fe 100644
--- a/src/libstore/common-protocol.hh
+++ b/src/libstore/common-protocol.hh
@@ -37,7 +37,6 @@ struct CommonProto
* canonical serializers below.
*/
struct WriteConn {
- Sink & to;
};
template<typename T>
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index 46500e7d3..4162015d6 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -264,7 +264,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
Source & from, BufferedSink & to, WorkerProto::Op op)
{
WorkerProto::ReadConn rconn{from, clientVersion};
- WorkerProto::WriteConn wconn{to, clientVersion};
+ WorkerProto::WriteConn wconn{clientVersion};
switch (op) {
@@ -291,7 +291,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
}
auto res = store->queryValidPaths(paths, substitute);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, res);
+ to << WorkerProto::write(*store, wconn, res);
break;
}
@@ -300,7 +300,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork();
auto res = store->querySubstitutablePaths(paths);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, res);
+ to << WorkerProto::write(*store, wconn, res);
break;
}
@@ -365,7 +365,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
#pragma GCC diagnostic pop
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, paths);
+ to << WorkerProto::write(*store, wconn, paths);
break;
}
@@ -385,7 +385,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork();
auto outputs = store->queryPartialDerivationOutputMap(path);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, outputs);
+ to << WorkerProto::write(*store, wconn, outputs);
break;
}
@@ -432,7 +432,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
}();
logger->stopWork();
- wconn.to << WorkerProto::Serialise<ValidPathInfo>::write(*store, wconn, *pathInfo);
+ to << WorkerProto::Serialise<ValidPathInfo>::write(*store, wconn, *pathInfo);
} else {
HashType hashAlgo;
std::string baseName;
@@ -565,7 +565,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto results = store->buildPathsWithResults(drvs, mode);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, results);
+ to << WorkerProto::write(*store, wconn, results);
break;
}
@@ -643,7 +643,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto res = store->buildDerivation(drvPath, drv, buildMode);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, res);
+ to << WorkerProto::write(*store, wconn, res);
break;
}
@@ -777,7 +777,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
else {
to << 1
<< (i->second.deriver ? store->printStorePath(*i->second.deriver) : "");
- wconn.to << WorkerProto::write(*store, wconn, i->second.references);
+ to << WorkerProto::write(*store, wconn, i->second.references);
to << i->second.downloadSize
<< i->second.narSize;
}
@@ -800,7 +800,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
for (auto & i : infos) {
to << store->printStorePath(i.first)
<< (i.second.deriver ? store->printStorePath(*i.second.deriver) : "");
- wconn.to << WorkerProto::write(*store, wconn, i.second.references);
+ to << WorkerProto::write(*store, wconn, i.second.references);
to << i.second.downloadSize << i.second.narSize;
}
break;
@@ -810,7 +810,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork();
auto paths = store->queryAllValidPaths();
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, paths);
+ to << WorkerProto::write(*store, wconn, paths);
break;
}
@@ -827,7 +827,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->stopWork();
if (info) {
to << 1;
- wconn.to << WorkerProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info));
+ to << WorkerProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info));
} else {
to << 0;
}
@@ -922,9 +922,9 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
uint64_t downloadSize, narSize;
store->queryMissing(targets, willBuild, willSubstitute, unknown, downloadSize, narSize);
logger->stopWork();
- wconn.to << WorkerProto::write(*store, wconn, willBuild);
- wconn.to << WorkerProto::write(*store, wconn, willSubstitute);
- wconn.to << WorkerProto::write(*store, wconn, unknown);
+ to << WorkerProto::write(*store, wconn, willBuild);
+ to << WorkerProto::write(*store, wconn, willSubstitute);
+ to << WorkerProto::write(*store, wconn, unknown);
to << downloadSize << narSize;
break;
}
@@ -952,11 +952,11 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
if (GET_PROTOCOL_MINOR(clientVersion) < 31) {
std::set<StorePath> outPaths;
if (info) outPaths.insert(info->outPath);
- wconn.to << WorkerProto::write(*store, wconn, outPaths);
+ to << WorkerProto::write(*store, wconn, outPaths);
} else {
std::set<Realisation> realisations;
if (info) realisations.insert(*info);
- wconn.to << WorkerProto::write(*store, wconn, realisations);
+ to << WorkerProto::write(*store, wconn, realisations);
}
break;
}
@@ -1036,8 +1036,8 @@ void processConnection(
auto temp = trusted
? store->isTrustedClient()
: std::optional { NotTrusted };
- WorkerProto::WriteConn wconn {to, clientVersion};
- wconn.to << WorkerProto::write(*store, wconn, temp);
+ WorkerProto::WriteConn wconn {clientVersion};
+ to << WorkerProto::write(*store, wconn, temp);
}
/* Send startup error messages to the client. */
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index cbb22e010..9d342892d 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -995,7 +995,7 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
}, i.second.raw);
}
out << CommonProto::write(store,
- CommonProto::WriteConn { .to = out },
+ CommonProto::WriteConn {},
drv.inputSrcs);
out << drv.platform << drv.builder << drv.args;
out << drv.env.size();
diff --git a/src/libstore/export-import.cc b/src/libstore/export-import.cc
index 0355e5c87..8f95919b1 100644
--- a/src/libstore/export-import.cc
+++ b/src/libstore/export-import.cc
@@ -47,7 +47,7 @@ void Store::exportPath(const StorePath & path, Sink & sink)
<< exportMagic
<< printStorePath(path);
teeSink << CommonProto::write(*this,
- CommonProto::WriteConn { .to = teeSink },
+ CommonProto::WriteConn {},
info->references);
teeSink
<< (info->deriver ? printStorePath(*info->deriver) : "")
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc
index e8394d805..032611f7c 100644
--- a/src/libstore/legacy-ssh-store.cc
+++ b/src/libstore/legacy-ssh-store.cc
@@ -74,7 +74,6 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
operator ServeProto::WriteConn ()
{
return ServeProto::WriteConn {
- .to = to,
.version = remoteVersion,
};
}
diff --git a/src/libstore/remote-store-connection.hh b/src/libstore/remote-store-connection.hh
index 1647afd0d..d827918c9 100644
--- a/src/libstore/remote-store-connection.hh
+++ b/src/libstore/remote-store-connection.hh
@@ -81,7 +81,7 @@ struct RemoteStore::Connection
*/
operator WorkerProto::WriteConn ()
{
- return WorkerProto::WriteConn {to, daemonVersion};
+ return WorkerProto::WriteConn {daemonVersion};
}
virtual ~Connection();
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index bf2e60918..56b6093bc 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -489,7 +489,7 @@ void RemoteStore::addMultipleToStore(
sink << pathsToCopy.size();
for (auto & [pathInfo, pathSource] : pathsToCopy) {
sink << WorkerProto::Serialise<ValidPathInfo>::write(*this,
- WorkerProto::WriteConn {sink, remoteVersion},
+ WorkerProto::WriteConn {remoteVersion},
pathInfo);
pathSource->drainInto(sink);
}
diff --git a/src/libstore/serve-protocol-impl.hh b/src/libstore/serve-protocol-impl.hh
index 845889451..cfb1dd574 100644
--- a/src/libstore/serve-protocol-impl.hh
+++ b/src/libstore/serve-protocol-impl.hh
@@ -50,7 +50,7 @@ struct ServeProto::Serialise
static WireFormatGenerator write(const Store & store, ServeProto::WriteConn conn, const T & t)
{
return CommonProto::Serialise<T>::write(store,
- CommonProto::WriteConn { .to = conn.to },
+ CommonProto::WriteConn {},
t);
}
};
diff --git a/src/libstore/serve-protocol.hh b/src/libstore/serve-protocol.hh
index 34c591a24..4285293fa 100644
--- a/src/libstore/serve-protocol.hh
+++ b/src/libstore/serve-protocol.hh
@@ -60,7 +60,6 @@ struct ServeProto
* canonical serializers below.
*/
struct WriteConn {
- Sink & to;
Version version;
};
diff --git a/src/libstore/worker-protocol-impl.hh b/src/libstore/worker-protocol-impl.hh
index 17c49385b..b2603b954 100644
--- a/src/libstore/worker-protocol-impl.hh
+++ b/src/libstore/worker-protocol-impl.hh
@@ -50,7 +50,7 @@ struct WorkerProto::Serialise
static WireFormatGenerator write(const Store & store, WorkerProto::WriteConn conn, const T & t)
{
return CommonProto::Serialise<T>::write(store,
- CommonProto::WriteConn { .to = conn.to },
+ CommonProto::WriteConn {},
t);
}
};
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index 9fb6d63e0..315e982dd 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -87,10 +87,9 @@ struct WorkerProto
* canonical serializers below.
*/
struct WriteConn {
- Sink & to;
Version version;
- WriteConn(Sink & to, Version version) : to(to), version(version) {
+ explicit WriteConn(Version version) : version(version) {
assert(version >= MIN_SUPPORTED_WORKER_PROTO_VERSION);
}
};
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index a2171a237..8d9a49536 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -824,7 +824,6 @@ static void opServe(Strings opFlags, Strings opArgs)
.version = clientVersion,
};
ServeProto::WriteConn wconn {
- .to = out,
.version = clientVersion,
};
@@ -881,7 +880,7 @@ static void opServe(Strings opFlags, Strings opArgs)
}
auto valid = store->queryValidPaths(paths);
- wconn.to << ServeProto::write(*store, wconn, valid);
+ out << ServeProto::write(*store, wconn, valid);
break;
}
@@ -892,7 +891,7 @@ static void opServe(Strings opFlags, Strings opArgs)
try {
auto info = store->queryPathInfo(i);
out << store->printStorePath(info->path);
- wconn.to << ServeProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info));
+ out << ServeProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info));
} catch (InvalidPath &) {
}
}
@@ -951,7 +950,7 @@ static void opServe(Strings opFlags, Strings opArgs)
MonitorFdHup monitor(in.fd);
auto status = store->buildDerivation(drvPath, drv);
- wconn.to << ServeProto::write(*store, wconn, status);
+ out << ServeProto::write(*store, wconn, status);
break;
}
@@ -960,7 +959,7 @@ static void opServe(Strings opFlags, Strings opArgs)
StorePathSet closure;
store->computeFSClosure(ServeProto::Serialise<StorePathSet>::read(*store, rconn),
closure, false, includeOutputs);
- wconn.to << ServeProto::write(*store, wconn, closure);
+ out << ServeProto::write(*store, wconn, closure);
break;
}
diff --git a/tests/unit/libstore/common-protocol.cc b/tests/unit/libstore/common-protocol.cc
index 1d25f81c7..86ba537db 100644
--- a/tests/unit/libstore/common-protocol.cc
+++ b/tests/unit/libstore/common-protocol.cc
@@ -52,7 +52,7 @@ public:
StringSink to;
to << CommonProto::write(
*store,
- CommonProto::WriteConn { .to = to },
+ CommonProto::WriteConn {},
value);
if (testAccept())
diff --git a/tests/unit/libstore/protocol.hh b/tests/unit/libstore/protocol.hh
index 269c9f7aa..059b4d91c 100644
--- a/tests/unit/libstore/protocol.hh
+++ b/tests/unit/libstore/protocol.hh
@@ -58,7 +58,7 @@ public:
StringSink to;
to << Proto::write(
*LibStoreTest::store,
- typename Proto::WriteConn {to, version},
+ typename Proto::WriteConn {version},
value);
if (testAccept())