aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/remote-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-21 16:34:00 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-21 16:34:00 +0000
commit0f5da8a83c227879566ed87623617fe195bc6f88 (patch)
tree68936736d29d839affea132f65004bfbcb587e1f /src/libstore/remote-store.cc
parentdc7d59477613e88b18133208f6c8b2f646e66260 (diff)
* Support exportPath() in remote mode.
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 801df58ad..dbeb7cf12 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -246,7 +246,11 @@ Path RemoteStore::addTextToStore(const string & suffix, const string & s,
void RemoteStore::exportPath(const Path & path, bool sign,
Sink & sink)
{
- throw Error("not implemented");
+ writeInt(wopExportPath, to);
+ writeString(path, to);
+ writeInt(sign ? 1 : 0, to);
+ processStderr(&sink); /* sink receives the actual data */
+ readInt(from);
}
@@ -336,12 +340,16 @@ void RemoteStore::collectGarbage(GCAction action, const PathSet & pathsToDelete,
}
-void RemoteStore::processStderr()
+void RemoteStore::processStderr(Sink * sink)
{
unsigned int msg;
- while ((msg = readInt(from)) == STDERR_NEXT) {
+ while ((msg = readInt(from)) == STDERR_NEXT || msg == STDERR_DATA) {
string s = readString(from);
- writeToStderr((unsigned char *) s.c_str(), s.size());
+ if (msg == STDERR_DATA) {
+ if (!sink) throw Error("no sink");
+ (*sink)((const unsigned char *) s.c_str(), s.size());
+ }
+ else writeToStderr((const unsigned char *) s.c_str(), s.size());
}
if (msg == STDERR_ERROR)
throw Error(readString(from));