nix::worker_proto -> worker_proto

This commit is contained in:
John Ericson 2020-09-30 00:41:18 +00:00
parent 45a0ed82f0
commit b759701652
8 changed files with 44 additions and 44 deletions

View file

@ -1976,7 +1976,7 @@ HookReply DerivationGoal::tryBuildHook()
/* Tell the hook all the inputs that have to be copied to the /* Tell the hook all the inputs that have to be copied to the
remote system. */ remote system. */
nix::worker_proto::write(worker.store, hook->sink, inputPaths); worker_proto::write(worker.store, hook->sink, inputPaths);
/* Tell the hooks the missing outputs that have to be copied back /* Tell the hooks the missing outputs that have to be copied back
from the remote system. */ from the remote system. */
@ -1987,7 +1987,7 @@ HookReply DerivationGoal::tryBuildHook()
if (buildMode != bmCheck && status.known->isValid()) continue; if (buildMode != bmCheck && status.known->isValid()) continue;
missingPaths.insert(status.known->path); missingPaths.insert(status.known->path);
} }
nix::worker_proto::write(worker.store, hook->sink, missingPaths); worker_proto::write(worker.store, hook->sink, missingPaths);
} }
hook->sink = FdSink(); hook->sink = FdSink();

View file

@ -247,7 +247,7 @@ static void writeValidPathInfo(
{ {
to << (info->deriver ? store->printStorePath(*info->deriver) : "") to << (info->deriver ? store->printStorePath(*info->deriver) : "")
<< info->narHash.to_string(Base16, false); << info->narHash.to_string(Base16, false);
nix::worker_proto::write(*store, to, info->references); worker_proto::write(*store, to, info->references);
to << info->registrationTime << info->narSize; to << info->registrationTime << info->narSize;
if (GET_PROTOCOL_MINOR(clientVersion) >= 16) { if (GET_PROTOCOL_MINOR(clientVersion) >= 16) {
to << info->ultimate to << info->ultimate
@ -272,11 +272,11 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
} }
case wopQueryValidPaths: { case wopQueryValidPaths: {
auto paths = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); auto paths = worker_proto::read(*store, from, Phantom<StorePathSet> {});
logger->startWork(); logger->startWork();
auto res = store->queryValidPaths(paths); auto res = store->queryValidPaths(paths);
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, res); worker_proto::write(*store, to, res);
break; break;
} }
@ -292,11 +292,11 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
} }
case wopQuerySubstitutablePaths: { case wopQuerySubstitutablePaths: {
auto paths = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); auto paths = worker_proto::read(*store, from, Phantom<StorePathSet> {});
logger->startWork(); logger->startWork();
auto res = store->querySubstitutablePaths(paths); auto res = store->querySubstitutablePaths(paths);
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, res); worker_proto::write(*store, to, res);
break; break;
} }
@ -325,7 +325,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
paths = store->queryValidDerivers(path); paths = store->queryValidDerivers(path);
else paths = store->queryDerivationOutputs(path); else paths = store->queryDerivationOutputs(path);
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, paths); worker_proto::write(*store, to, paths);
break; break;
} }
@ -343,7 +343,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork(); logger->startWork();
auto outputs = store->queryPartialDerivationOutputMap(path); auto outputs = store->queryPartialDerivationOutputMap(path);
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, outputs); worker_proto::write(*store, to, outputs);
break; break;
} }
@ -369,7 +369,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
if (GET_PROTOCOL_MINOR(clientVersion) >= 25) { if (GET_PROTOCOL_MINOR(clientVersion) >= 25) {
auto name = readString(from); auto name = readString(from);
auto camStr = readString(from); auto camStr = readString(from);
auto refs = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); auto refs = worker_proto::read(*store, from, Phantom<StorePathSet> {});
bool repairBool; bool repairBool;
from >> repairBool; from >> repairBool;
auto repair = RepairFlag{repairBool}; auto repair = RepairFlag{repairBool};
@ -449,7 +449,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
case wopAddTextToStore: { case wopAddTextToStore: {
string suffix = readString(from); string suffix = readString(from);
string s = readString(from); string s = readString(from);
auto refs = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); auto refs = worker_proto::read(*store, from, Phantom<StorePathSet> {});
logger->startWork(); logger->startWork();
auto path = store->addTextToStore(suffix, s, refs, NoRepair); auto path = store->addTextToStore(suffix, s, refs, NoRepair);
logger->stopWork(); logger->stopWork();
@ -608,7 +608,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
case wopCollectGarbage: { case wopCollectGarbage: {
GCOptions options; GCOptions options;
options.action = (GCOptions::GCAction) readInt(from); options.action = (GCOptions::GCAction) readInt(from);
options.pathsToDelete = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); options.pathsToDelete = worker_proto::read(*store, from, Phantom<StorePathSet> {});
from >> options.ignoreLiveness >> options.maxFreed; from >> options.ignoreLiveness >> options.maxFreed;
// obsolete fields // obsolete fields
readInt(from); readInt(from);
@ -677,7 +677,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
else { else {
to << 1 to << 1
<< (i->second.deriver ? store->printStorePath(*i->second.deriver) : ""); << (i->second.deriver ? store->printStorePath(*i->second.deriver) : "");
nix::worker_proto::write(*store, to, i->second.references); worker_proto::write(*store, to, i->second.references);
to << i->second.downloadSize to << i->second.downloadSize
<< i->second.narSize; << i->second.narSize;
} }
@ -688,11 +688,11 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
SubstitutablePathInfos infos; SubstitutablePathInfos infos;
StorePathCAMap pathsMap = {}; StorePathCAMap pathsMap = {};
if (GET_PROTOCOL_MINOR(clientVersion) < 22) { if (GET_PROTOCOL_MINOR(clientVersion) < 22) {
auto paths = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); auto paths = worker_proto::read(*store, from, Phantom<StorePathSet> {});
for (auto & path : paths) for (auto & path : paths)
pathsMap.emplace(path, std::nullopt); pathsMap.emplace(path, std::nullopt);
} else } else
pathsMap = nix::worker_proto::read(*store, from, Phantom<StorePathCAMap> {}); pathsMap = worker_proto::read(*store, from, Phantom<StorePathCAMap> {});
logger->startWork(); logger->startWork();
store->querySubstitutablePathInfos(pathsMap, infos); store->querySubstitutablePathInfos(pathsMap, infos);
logger->stopWork(); logger->stopWork();
@ -700,7 +700,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
for (auto & i : infos) { for (auto & i : infos) {
to << store->printStorePath(i.first) to << store->printStorePath(i.first)
<< (i.second.deriver ? store->printStorePath(*i.second.deriver) : ""); << (i.second.deriver ? store->printStorePath(*i.second.deriver) : "");
nix::worker_proto::write(*store, to, i.second.references); worker_proto::write(*store, to, i.second.references);
to << i.second.downloadSize << i.second.narSize; to << i.second.downloadSize << i.second.narSize;
} }
break; break;
@ -710,7 +710,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork(); logger->startWork();
auto paths = store->queryAllValidPaths(); auto paths = store->queryAllValidPaths();
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, paths); worker_proto::write(*store, to, paths);
break; break;
} }
@ -782,7 +782,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
ValidPathInfo info { path, narHash }; ValidPathInfo info { path, narHash };
if (deriver != "") if (deriver != "")
info.deriver = store->parseStorePath(deriver); info.deriver = store->parseStorePath(deriver);
info.references = nix::worker_proto::read(*store, from, Phantom<StorePathSet> {}); info.references = worker_proto::read(*store, from, Phantom<StorePathSet> {});
from >> info.registrationTime >> info.narSize >> info.ultimate; from >> info.registrationTime >> info.narSize >> info.ultimate;
info.sigs = readStrings<StringSet>(from); info.sigs = readStrings<StringSet>(from);
info.ca = parseContentAddressOpt(readString(from)); info.ca = parseContentAddressOpt(readString(from));
@ -835,9 +835,9 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
uint64_t downloadSize, narSize; uint64_t downloadSize, narSize;
store->queryMissing(targets, willBuild, willSubstitute, unknown, downloadSize, narSize); store->queryMissing(targets, willBuild, willSubstitute, unknown, downloadSize, narSize);
logger->stopWork(); logger->stopWork();
nix::worker_proto::write(*store, to, willBuild); worker_proto::write(*store, to, willBuild);
nix::worker_proto::write(*store, to, willSubstitute); worker_proto::write(*store, to, willSubstitute);
nix::worker_proto::write(*store, to, unknown); worker_proto::write(*store, to, unknown);
to << downloadSize << narSize; to << downloadSize << narSize;
break; break;
} }

View file

@ -584,7 +584,7 @@ Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv,
drv.outputs.emplace(std::move(name), std::move(output)); drv.outputs.emplace(std::move(name), std::move(output));
} }
drv.inputSrcs = nix::worker_proto::read(store, in, Phantom<StorePathSet> {}); drv.inputSrcs = worker_proto::read(store, in, Phantom<StorePathSet> {});
in >> drv.platform >> drv.builder; in >> drv.platform >> drv.builder;
drv.args = readStrings<Strings>(in); drv.args = readStrings<Strings>(in);
@ -622,7 +622,7 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
}, },
}, i.second.output); }, i.second.output);
} }
nix::worker_proto::write(store, out, drv.inputSrcs); worker_proto::write(store, out, drv.inputSrcs);
out << drv.platform << drv.builder << drv.args; out << drv.platform << drv.builder << drv.args;
out << drv.env.size(); out << drv.env.size();
for (auto & i : drv.env) for (auto & i : drv.env)

View file

@ -45,7 +45,7 @@ void Store::exportPath(const StorePath & path, Sink & sink)
teeSink teeSink
<< exportMagic << exportMagic
<< printStorePath(path); << printStorePath(path);
nix::worker_proto::write(*this, teeSink, info->references); worker_proto::write(*this, teeSink, info->references);
teeSink teeSink
<< (info->deriver ? printStorePath(*info->deriver) : "") << (info->deriver ? printStorePath(*info->deriver) : "")
<< 0; << 0;
@ -73,7 +73,7 @@ StorePaths Store::importPaths(Source & source, CheckSigsFlag checkSigs)
//Activity act(*logger, lvlInfo, format("importing path '%s'") % info.path); //Activity act(*logger, lvlInfo, format("importing path '%s'") % info.path);
auto references = nix::worker_proto::read(*this, source, Phantom<StorePathSet> {}); auto references = worker_proto::read(*this, source, Phantom<StorePathSet> {});
auto deriver = readString(source); auto deriver = readString(source);
auto narHash = hashString(htSHA256, *saved.s); auto narHash = hashString(htSHA256, *saved.s);

View file

@ -122,7 +122,7 @@ struct LegacySSHStore : public Store, public virtual LegacySSHStoreConfig
auto deriver = readString(conn->from); auto deriver = readString(conn->from);
if (deriver != "") if (deriver != "")
info->deriver = parseStorePath(deriver); info->deriver = parseStorePath(deriver);
info->references = nix::worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}); info->references = worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
readLongLong(conn->from); // download size readLongLong(conn->from); // download size
info->narSize = readLongLong(conn->from); info->narSize = readLongLong(conn->from);
@ -156,7 +156,7 @@ struct LegacySSHStore : public Store, public virtual LegacySSHStoreConfig
<< printStorePath(info.path) << printStorePath(info.path)
<< (info.deriver ? printStorePath(*info.deriver) : "") << (info.deriver ? printStorePath(*info.deriver) : "")
<< info.narHash.to_string(Base16, false); << info.narHash.to_string(Base16, false);
nix::worker_proto::write(*this, conn->to, info.references); worker_proto::write(*this, conn->to, info.references);
conn->to conn->to
<< info.registrationTime << info.registrationTime
<< info.narSize << info.narSize
@ -185,7 +185,7 @@ struct LegacySSHStore : public Store, public virtual LegacySSHStoreConfig
conn->to conn->to
<< exportMagic << exportMagic
<< printStorePath(info.path); << printStorePath(info.path);
nix::worker_proto::write(*this, conn->to, info.references); worker_proto::write(*this, conn->to, info.references);
conn->to conn->to
<< (info.deriver ? printStorePath(*info.deriver) : "") << (info.deriver ? printStorePath(*info.deriver) : "")
<< 0 << 0
@ -301,10 +301,10 @@ public:
conn->to conn->to
<< cmdQueryClosure << cmdQueryClosure
<< includeOutputs; << includeOutputs;
nix::worker_proto::write(*this, conn->to, paths); worker_proto::write(*this, conn->to, paths);
conn->to.flush(); conn->to.flush();
for (auto & i : nix::worker_proto::read(*this, conn->from, Phantom<StorePathSet> {})) for (auto & i : worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}))
out.insert(i); out.insert(i);
} }
@ -317,10 +317,10 @@ public:
<< cmdQueryValidPaths << cmdQueryValidPaths
<< false // lock << false // lock
<< maybeSubstitute; << maybeSubstitute;
nix::worker_proto::write(*this, conn->to, paths); worker_proto::write(*this, conn->to, paths);
conn->to.flush(); conn->to.flush();
return nix::worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}); return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
} }
void connect() override void connect() override

View file

@ -329,7 +329,7 @@ StorePathSet RemoteStore::queryValidPaths(const StorePathSet & paths, Substitute
return res; return res;
} else { } else {
conn->to << wopQueryValidPaths; conn->to << wopQueryValidPaths;
nix::worker_proto::write(*this, conn->to, paths); worker_proto::write(*this, conn->to, paths);
conn.processStderr(); conn.processStderr();
return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}); return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
} }
@ -341,7 +341,7 @@ StorePathSet RemoteStore::queryAllValidPaths()
auto conn(getConnection()); auto conn(getConnection());
conn->to << wopQueryAllValidPaths; conn->to << wopQueryAllValidPaths;
conn.processStderr(); conn.processStderr();
return nix::worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}); return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
} }
@ -358,7 +358,7 @@ StorePathSet RemoteStore::querySubstitutablePaths(const StorePathSet & paths)
return res; return res;
} else { } else {
conn->to << wopQuerySubstitutablePaths; conn->to << wopQuerySubstitutablePaths;
nix::worker_proto::write(*this, conn->to, paths); worker_proto::write(*this, conn->to, paths);
conn.processStderr(); conn.processStderr();
return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {}); return worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
} }

View file

@ -153,7 +153,7 @@ void write(const Store & store, Sink & out, const std::optional<T> & optVal)
{ {
out << (uint64_t) (optVal ? 1 : 0); out << (uint64_t) (optVal ? 1 : 0);
if (optVal) if (optVal)
nix::worker_proto::write(store, out, *optVal); worker_proto::write(store, out, *optVal);
} }
/* Specialization which uses and empty string for the empty case, taking /* Specialization which uses and empty string for the empty case, taking

View file

@ -822,7 +822,7 @@ static void opServe(Strings opFlags, Strings opArgs)
case cmdQueryValidPaths: { case cmdQueryValidPaths: {
bool lock = readInt(in); bool lock = readInt(in);
bool substitute = readInt(in); bool substitute = readInt(in);
auto paths = nix::worker_proto::read(*store, in, Phantom<StorePathSet> {}); auto paths = worker_proto::read(*store, in, Phantom<StorePathSet> {});
if (lock && writeAllowed) if (lock && writeAllowed)
for (auto & path : paths) for (auto & path : paths)
store->addTempRoot(path); store->addTempRoot(path);
@ -852,19 +852,19 @@ static void opServe(Strings opFlags, Strings opArgs)
} }
} }
nix::worker_proto::write(*store, out, store->queryValidPaths(paths)); worker_proto::write(*store, out, store->queryValidPaths(paths));
break; break;
} }
case cmdQueryPathInfos: { case cmdQueryPathInfos: {
auto paths = nix::worker_proto::read(*store, in, Phantom<StorePathSet> {}); auto paths = worker_proto::read(*store, in, Phantom<StorePathSet> {});
// !!! Maybe we want a queryPathInfos? // !!! Maybe we want a queryPathInfos?
for (auto & i : paths) { for (auto & i : paths) {
try { try {
auto info = store->queryPathInfo(i); auto info = store->queryPathInfo(i);
out << store->printStorePath(info->path) out << store->printStorePath(info->path)
<< (info->deriver ? store->printStorePath(*info->deriver) : ""); << (info->deriver ? store->printStorePath(*info->deriver) : "");
nix::worker_proto::write(*store, out, info->references); worker_proto::write(*store, out, info->references);
// !!! Maybe we want compression? // !!! Maybe we want compression?
out << info->narSize // downloadSize out << info->narSize // downloadSize
<< info->narSize; << info->narSize;
@ -892,7 +892,7 @@ static void opServe(Strings opFlags, Strings opArgs)
case cmdExportPaths: { case cmdExportPaths: {
readInt(in); // obsolete readInt(in); // obsolete
store->exportPaths(nix::worker_proto::read(*store, in, Phantom<StorePathSet> {}), out); store->exportPaths(worker_proto::read(*store, in, Phantom<StorePathSet> {}), out);
break; break;
} }
@ -941,9 +941,9 @@ static void opServe(Strings opFlags, Strings opArgs)
case cmdQueryClosure: { case cmdQueryClosure: {
bool includeOutputs = readInt(in); bool includeOutputs = readInt(in);
StorePathSet closure; StorePathSet closure;
store->computeFSClosure(nix::worker_proto::read(*store, in, Phantom<StorePathSet> {}), store->computeFSClosure(worker_proto::read(*store, in, Phantom<StorePathSet> {}),
closure, false, includeOutputs); closure, false, includeOutputs);
nix::worker_proto::write(*store, out, closure); worker_proto::write(*store, out, closure);
break; break;
} }
@ -958,7 +958,7 @@ static void opServe(Strings opFlags, Strings opArgs)
}; };
if (deriver != "") if (deriver != "")
info.deriver = store->parseStorePath(deriver); info.deriver = store->parseStorePath(deriver);
info.references = nix::worker_proto::read(*store, in, Phantom<StorePathSet> {}); info.references = worker_proto::read(*store, in, Phantom<StorePathSet> {});
in >> info.registrationTime >> info.narSize >> info.ultimate; in >> info.registrationTime >> info.narSize >> info.ultimate;
info.sigs = readStrings<StringSet>(in); info.sigs = readStrings<StringSet>(in);
info.ca = parseContentAddressOpt(readString(in)); info.ca = parseContentAddressOpt(readString(in));