summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 18:35:36 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 18:35:36 +0000
commit9cf1948993659cc394eccea5890e14df82eff8bb (patch)
tree60564d61d6f38a62b4e4b81d4918db2969a90a4d
parent6ecb840fd118019f879de60007e13321b7c080d3 (diff)
downloadguix-9cf1948993659cc394eccea5890e14df82eff8bb.tar.gz
* Skeleton of remote store implementation.
-rw-r--r--src/libstore/Makefile.am8
-rw-r--r--src/libstore/local-store.cc1
-rw-r--r--src/libstore/store-api.cc9
-rw-r--r--src/nix-env/profiles.cc2
4 files changed, 14 insertions, 6 deletions
diff --git a/src/libstore/Makefile.am b/src/libstore/Makefile.am
index 4d25c2d689..1f294fde66 100644
--- a/src/libstore/Makefile.am
+++ b/src/libstore/Makefile.am
@@ -1,12 +1,12 @@
 pkglib_LTLIBRARIES = libstore.la
 
 libstore_la_SOURCES = \
- store-api.cc local-store.cc derivations.cc build.cc misc.cc globals.cc \
- db.cc references.cc pathlocks.cc gc.cc 
+ store-api.cc local-store.cc remote-store.cc derivations.cc build.cc misc.cc \
+ globals.cc db.cc references.cc pathlocks.cc gc.cc 
 
 pkginclude_HEADERS = \
- store-api.hh local-store.cc derivations.hh misc.hh globals.hh \
- db.hh references.hh pathlocks.hh gc.hh 
+ store-api.hh local-store.cc remote-store.cc derivations.hh misc.hh \
+ globals.hh db.hh references.hh pathlocks.hh gc.hh 
 
 libstore_la_LIBADD = ../libutil/libutil.la ../boost/format/libformat.la
 
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index c8bb60bce6..2ae4437623 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #include <utime.h>
 
+
 namespace nix {
 
     
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 3a07d1c73c..092d7f1e94 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -1,5 +1,6 @@
 #include "store-api.hh"
 #include "globals.hh"
+#include "util.hh"
 
 
 namespace nix {
@@ -90,6 +91,7 @@ Path makeFixedOutputPath(bool recursive,
 
 
 #include "local-store.hh"
+#include "remote-store.hh"
 
 
 namespace nix {
@@ -100,7 +102,12 @@ boost::shared_ptr<StoreAPI> store;
 
 boost::shared_ptr<StoreAPI> openStore(bool reserveSpace)
 {
-    return boost::shared_ptr<StoreAPI>(new LocalStore(reserveSpace));
+    string mode = getEnv("NIX_REMOTE");
+    if (mode == "")
+        return boost::shared_ptr<StoreAPI>(new LocalStore(reserveSpace));
+    else if (mode == "slave")
+        return boost::shared_ptr<StoreAPI>(new RemoteStore());
+    else throw Error(format("invalid setting for NIX_REMOTE, `%1%'") % mode);
 }
 
 
diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc
index ab0c4977bd..0014161842 100644
--- a/src/nix-env/profiles.cc
+++ b/src/nix-env/profiles.cc
@@ -85,7 +85,7 @@ Path createGeneration(Path profile, Path outPath)
 
     /* Create the new generation.  Note that addPermRoot() blocks if
        the garbage collector is running to prevent the stuff we've
-       build from moving from the temporary roots (which the GC knows)
+       built from moving from the temporary roots (which the GC knows)
        to the permanent roots (of which the GC would have a stale
        view).  If we didn't do it this way, the GC might remove the
        user environment etc. we've just built. */