aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/remote-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05 01:31:45 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05 01:31:45 +0000
commit29cf434a35d82529f56c085c9cd50858c148d086 (patch)
treeed6df2ab56312989b4e8e50ba5b246b9d5641396 /src/libstore/remote-store.cc
parent8623256f483f77e090e689ae332165a530a489a5 (diff)
* 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.
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 8dd87d046..6ddbb3e2a 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -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;