1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

WIP systematize more of the worker protocol

This refactor should *not* change the wire protocol.
This commit is contained in:
John Ericson 2020-08-04 19:02:05 +00:00
parent fbeb8695fb
commit 2f2ae993dc
9 changed files with 132 additions and 135 deletions

View file

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