nix-store --serve: Don't loop forever
nix-store --export takes a tmproot, which can only release by exiting. Substituters don't currently work in a way that could take advantage of the looping, anyway. Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
3a38d0f356
commit
9488447594
1 changed files with 25 additions and 26 deletions
|
@ -260,32 +260,31 @@ string StoreAPI::makeValidityRegistration(const PathSet & paths,
|
|||
|
||||
void StoreAPI::serve(Source & in, Sink & out, bool sign)
|
||||
{
|
||||
for (string cmd = readString(in); !cmd.empty(); cmd = readString(in)) {
|
||||
if (cmd == "query") {
|
||||
for (cmd = readString(in); !cmd.empty(); cmd = readString(in)) {
|
||||
PathSet paths = readStrings<PathSet>(in);
|
||||
if (cmd == "have") {
|
||||
writeStrings(queryValidPaths(paths), out);
|
||||
} else if (cmd == "info") {
|
||||
// !!! Maybe we want a queryPathInfos?
|
||||
foreach (PathSet::iterator, i, paths) {
|
||||
ValidPathInfo info = queryPathInfo(*i);
|
||||
writeString(info.path, out);
|
||||
writeString(info.deriver, out);
|
||||
writeStrings(info.references, out);
|
||||
// !!! Maybe we want compression?
|
||||
writeLongLong(info.narSize, out); // downloadSize
|
||||
writeLongLong(info.narSize, out);
|
||||
}
|
||||
writeString("", out);
|
||||
} else
|
||||
throw Error(format("Unknown serve query `%1%'") % cmd);
|
||||
}
|
||||
} else if (cmd == "substitute")
|
||||
exportPath(readString(in), sign, out);
|
||||
else
|
||||
throw Error(format("Unknown serve command `%1%'") % cmd);
|
||||
}
|
||||
string cmd = readString(in);
|
||||
if (cmd == "query") {
|
||||
for (cmd = readString(in); !cmd.empty(); cmd = readString(in)) {
|
||||
PathSet paths = readStrings<PathSet>(in);
|
||||
if (cmd == "have") {
|
||||
writeStrings(queryValidPaths(paths), out);
|
||||
} else if (cmd == "info") {
|
||||
// !!! Maybe we want a queryPathInfos?
|
||||
foreach (PathSet::iterator, i, paths) {
|
||||
ValidPathInfo info = queryPathInfo(*i);
|
||||
writeString(info.path, out);
|
||||
writeString(info.deriver, out);
|
||||
writeStrings(info.references, out);
|
||||
// !!! Maybe we want compression?
|
||||
writeLongLong(info.narSize, out); // downloadSize
|
||||
writeLongLong(info.narSize, out);
|
||||
}
|
||||
writeString("", out);
|
||||
} else
|
||||
throw Error(format("Unknown serve query `%1%'") % cmd);
|
||||
}
|
||||
} else if (cmd == "substitute")
|
||||
exportPath(readString(in), sign, out);
|
||||
else
|
||||
throw Error(format("Unknown serve command `%1%'") % cmd);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue