mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
* Implement RemoteStore::queryPathInfo().
This commit is contained in:
parent
a3883cbd28
commit
1db6259076
3 changed files with 27 additions and 1 deletions
|
@ -249,7 +249,19 @@ bool RemoteStore::querySubstitutablePathInfo(const Path & path,
|
||||||
|
|
||||||
ValidPathInfo RemoteStore::queryPathInfo(const Path & path)
|
ValidPathInfo RemoteStore::queryPathInfo(const Path & path)
|
||||||
{
|
{
|
||||||
throw Error("not implemented");
|
openConnection();
|
||||||
|
writeInt(wopQueryPathInfo, to);
|
||||||
|
writeString(path, to);
|
||||||
|
processStderr();
|
||||||
|
ValidPathInfo info;
|
||||||
|
info.path = path;
|
||||||
|
info.deriver = readString(from);
|
||||||
|
if (info.deriver != "") assertStorePath(info.deriver);
|
||||||
|
info.hash = parseHash(htSHA256, readString(from));
|
||||||
|
info.references = readStorePaths(from);
|
||||||
|
info.registrationTime = readInt(from);
|
||||||
|
info.narSize = readLongLong(from);
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ typedef enum {
|
||||||
wopQueryValidPaths = 23,
|
wopQueryValidPaths = 23,
|
||||||
wopQueryFailedPaths = 24,
|
wopQueryFailedPaths = 24,
|
||||||
wopClearFailedPaths = 25,
|
wopClearFailedPaths = 25,
|
||||||
|
wopQueryPathInfo = 26,
|
||||||
} WorkerOp;
|
} WorkerOp;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -550,6 +550,19 @@ static void performOp(unsigned int clientVersion,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case wopQueryPathInfo: {
|
||||||
|
Path path = readStorePath(from);
|
||||||
|
startWork();
|
||||||
|
ValidPathInfo info = store->queryPathInfo(path);
|
||||||
|
stopWork();
|
||||||
|
writeString(info.deriver, to);
|
||||||
|
writeString(printHash(info.hash), to);
|
||||||
|
writeStringSet(info.references, to);
|
||||||
|
writeInt(info.registrationTime, to);
|
||||||
|
writeLongLong(info.narSize, to);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw Error(format("invalid operation %1%") % op);
|
throw Error(format("invalid operation %1%") % op);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue