mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
Put worker protocol items inside a WorkerProto
struct
See API docs on that struct for why. The pasing as as template argument doesn't yet happen in that commit, but will instead happen in later commit. Also make `WorkerOp` (now `Op`) and enum struct. This led us to catch that two operations were not handled! Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
469d06f9bc
commit
95eae0c002
12 changed files with 327 additions and 273 deletions
|
@ -147,7 +147,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
|||
auto deriver = readString(conn->from);
|
||||
if (deriver != "")
|
||||
info->deriver = parseStorePath(deriver);
|
||||
info->references = WorkerProto<StorePathSet>::read(*this, conn->from);
|
||||
info->references = WorkerProto::Serialise<StorePathSet>::read(*this, conn->from);
|
||||
readLongLong(conn->from); // download size
|
||||
info->narSize = readLongLong(conn->from);
|
||||
|
||||
|
@ -181,7 +181,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
|||
<< printStorePath(info.path)
|
||||
<< (info.deriver ? printStorePath(*info.deriver) : "")
|
||||
<< info.narHash.to_string(Base16, false);
|
||||
workerProtoWrite(*this, conn->to, info.references);
|
||||
WorkerProto::write(*this, conn->to, info.references);
|
||||
conn->to
|
||||
<< info.registrationTime
|
||||
<< info.narSize
|
||||
|
@ -210,7 +210,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
|||
conn->to
|
||||
<< exportMagic
|
||||
<< printStorePath(info.path);
|
||||
workerProtoWrite(*this, conn->to, info.references);
|
||||
WorkerProto::write(*this, conn->to, info.references);
|
||||
conn->to
|
||||
<< (info.deriver ? printStorePath(*info.deriver) : "")
|
||||
<< 0
|
||||
|
@ -295,7 +295,7 @@ public:
|
|||
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 3)
|
||||
conn->from >> status.timesBuilt >> status.isNonDeterministic >> status.startTime >> status.stopTime;
|
||||
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 6) {
|
||||
auto builtOutputs = WorkerProto<DrvOutputs>::read(*this, conn->from);
|
||||
auto builtOutputs = WorkerProto::Serialise<DrvOutputs>::read(*this, conn->from);
|
||||
for (auto && [output, realisation] : builtOutputs)
|
||||
status.builtOutputs.insert_or_assign(
|
||||
std::move(output.outputName),
|
||||
|
@ -370,10 +370,10 @@ public:
|
|||
conn->to
|
||||
<< cmdQueryClosure
|
||||
<< includeOutputs;
|
||||
workerProtoWrite(*this, conn->to, paths);
|
||||
WorkerProto::write(*this, conn->to, paths);
|
||||
conn->to.flush();
|
||||
|
||||
for (auto & i : WorkerProto<StorePathSet>::read(*this, conn->from))
|
||||
for (auto & i : WorkerProto::Serialise<StorePathSet>::read(*this, conn->from))
|
||||
out.insert(i);
|
||||
}
|
||||
|
||||
|
@ -386,10 +386,10 @@ public:
|
|||
<< cmdQueryValidPaths
|
||||
<< false // lock
|
||||
<< maybeSubstitute;
|
||||
workerProtoWrite(*this, conn->to, paths);
|
||||
WorkerProto::write(*this, conn->to, paths);
|
||||
conn->to.flush();
|
||||
|
||||
return WorkerProto<StorePathSet>::read(*this, conn->from);
|
||||
return WorkerProto::Serialise<StorePathSet>::read(*this, conn->from);
|
||||
}
|
||||
|
||||
void connect() override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue