summary refs log tree commit diff
path: root/src/nix-worker
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/nix-worker
parentdc7d59477613e88b18133208f6c8b2f646e66260 (diff)
downloadguix-0f5da8a83c227879566ed87623617fe195bc6f88.tar.gz
* Support exportPath() in remote mode.
Diffstat (limited to 'src/nix-worker')
-rw-r--r--src/nix-worker/nix-worker.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc
index 17fbbf2646..04578a8b87 100644
--- a/src/nix-worker/nix-worker.cc
+++ b/src/nix-worker/nix-worker.cc
@@ -178,6 +178,21 @@ static void stopWork(bool success = true, const string & msg = "")
 }
 
 
+struct TunnelSink : Sink
+{
+    Sink & to;
+    TunnelSink(Sink & to) : to(to)
+    {
+    }
+    virtual void operator ()
+        (const unsigned char * data, unsigned int len)
+    {
+        writeInt(STDERR_DATA, to);
+        writeString(string((const char *) data, len), to);
+    }
+};
+
+
 static void performOp(Source & from, Sink & to, unsigned int op)
 {
     switch (op) {
@@ -263,6 +278,17 @@ static void performOp(Source & from, Sink & to, unsigned int op)
         break;
     }
 
+    case wopExportPath: {
+        Path path = readStorePath(from);
+        bool sign = readInt(from) == 1;
+        startWork();
+        TunnelSink sink(to);
+        store->exportPath(path, sign, sink);
+        stopWork();
+        writeInt(1, to);
+        break;
+    }
+
     case wopBuildDerivations: {
         PathSet drvs = readStorePaths(from);
         startWork();