mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 07:52:43 +01:00
* The determination of the root set should be made by the privileged
process, so forward the operation. * Spam the user about GC misconfigurations (NIX-71). * findRoots: skip all roots that are unreadable - the warnings with which we spam the user should be enough.
This commit is contained in:
parent
8623256f48
commit
29cf434a35
9 changed files with 140 additions and 79 deletions
|
|
@ -18,6 +18,23 @@
|
|||
namespace nix {
|
||||
|
||||
|
||||
Path readStorePath(Source & from)
|
||||
{
|
||||
Path path = readString(from);
|
||||
assertStorePath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
PathSet readStorePaths(Source & from)
|
||||
{
|
||||
PathSet paths = readStringSet(from);
|
||||
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i)
|
||||
assertStorePath(*i);
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
RemoteStore::RemoteStore()
|
||||
{
|
||||
string remoteMode = getEnv("NIX_REMOTE");
|
||||
|
|
@ -179,7 +196,7 @@ void RemoteStore::queryReferences(const Path & path,
|
|||
writeInt(wopQueryReferences, to);
|
||||
writeString(path, to);
|
||||
processStderr();
|
||||
PathSet references2 = readStringSet(from);
|
||||
PathSet references2 = readStorePaths(from);
|
||||
references.insert(references2.begin(), references2.end());
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +207,7 @@ void RemoteStore::queryReferrers(const Path & path,
|
|||
writeInt(wopQueryReferrers, to);
|
||||
writeString(path, to);
|
||||
processStderr();
|
||||
PathSet referrers2 = readStringSet(from);
|
||||
PathSet referrers2 = readStorePaths(from);
|
||||
referrers.insert(referrers2.begin(), referrers2.end());
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +224,7 @@ Path RemoteStore::addToStore(const Path & _srcPath, bool fixed,
|
|||
writeString(hashAlgo, to);
|
||||
dumpPath(srcPath, to);
|
||||
processStderr();
|
||||
Path path = readString(from);
|
||||
Path path = readStorePath(from);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +238,7 @@ Path RemoteStore::addTextToStore(const string & suffix, const string & s,
|
|||
writeStringSet(references, to);
|
||||
|
||||
processStderr();
|
||||
Path path = readString(from);
|
||||
Path path = readStorePath(from);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
@ -270,6 +287,21 @@ void RemoteStore::syncWithGC()
|
|||
}
|
||||
|
||||
|
||||
Roots RemoteStore::findRoots()
|
||||
{
|
||||
writeInt(wopFindRoots, to);
|
||||
processStderr();
|
||||
unsigned int count = readInt(from);
|
||||
Roots result;
|
||||
while (count--) {
|
||||
Path link = readString(from);
|
||||
Path target = readStorePath(from);
|
||||
result[link] = target;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void RemoteStore::processStderr()
|
||||
{
|
||||
unsigned int msg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue