aboutsummaryrefslogtreecommitdiff
path: root/src/nix-worker/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 20:45:20 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 20:45:20 +0000
commit02632790713eaabd5250ba04283233c8bc078067 (patch)
tree4848b09faade056cbb76fc28a72b477011eaf4f7 /src/nix-worker/main.cc
parenta711689368fe0915a2f18ea61fe6e953647d0174 (diff)
* More operations.
Diffstat (limited to 'src/nix-worker/main.cc')
-rw-r--r--src/nix-worker/main.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc
index d6966c2bf..d834e625e 100644
--- a/src/nix-worker/main.cc
+++ b/src/nix-worker/main.cc
@@ -3,6 +3,7 @@
#include "util.hh"
#include "serialise.hh"
#include "worker-protocol.hh"
+#include "archive.hh"
using namespace nix;
@@ -40,8 +41,33 @@ void processConnection(Source & from, Sink & to)
break;
}
+ case wopAddToStore: {
+ /* !!! uberquick hack */
+ string baseName = readString(from);
+ Path tmp = createTempDir();
+ Path tmp2 = tmp + "/" + baseName;
+ restorePath(tmp2, from);
+ writeString(store->addToStore(tmp2), to);
+ deletePath(tmp);
+ break;
+ }
+
+ case wopAddTextToStore: {
+ string suffix = readString(from);
+ string s = readString(from);
+ unsigned int refCount = readInt(from);
+ PathSet refs;
+ while (refCount--) {
+ Path ref = readString(from);
+ assertStorePath(ref);
+ refs.insert(ref);
+ }
+ writeString(store->addTextToStore(suffix, s, refs), to);
+ break;
+ }
+
default:
- throw Error("invalid operation");
+ throw Error(format("invalid operation %1%") % op);
}
} while (!quit);