about summary refs log tree commit diff
path: root/src/libstore/local-store.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-02T12·54+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-02T12·54+0000
commit3c92ea399d717dc45b3fa91424c0dadc0239ebf2 (patch)
tree7cde9f533a6ee575615da5452e04c05dc0939f02 /src/libstore/local-store.hh
parentfc691e1cbdcddb8c553cba06d4089bc1b60e3d98 (diff)
* Make nix-env --dry-run print the paths to be substituted correctly
  again.  (After the previous substituter mechanism refactoring I
  didn't update the code that obtains the references of substitutable
  paths.)  This required some refactoring: the substituter programs
  are now kept running and receive/respond to info requests via
  stdin/stdout.

Diffstat (limited to 'src/libstore/local-store.hh')
-rw-r--r--src/libstore/local-store.hh23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 1957b9f57948..f096bdd8557a 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -3,6 +3,8 @@
 
 #include <string>
 
+#include <ext/stdio_filebuf.h>
+
 #include "store-api.hh"
 #include "util.hh"
 
@@ -34,11 +36,26 @@ struct OptimiseStats
 };
 
 
+typedef __gnu_cxx::stdio_filebuf<char> stdio_filebuf;
+
+
+struct RunningSubstituter
+{
+    Pid pid;
+    boost::shared_ptr<stdio_filebuf> toBuf, fromBuf;
+    boost::shared_ptr<std::ostream> to;
+    boost::shared_ptr<std::istream> from;
+};
+
+
 class LocalStore : public StoreAPI
 {
 private:
     bool substitutablePathsLoaded;
     PathSet substitutablePaths;
+
+    typedef std::map<Path, RunningSubstituter> RunningSubstituters;
+    RunningSubstituters runningSubstituters;
     
 public:
 
@@ -65,6 +82,9 @@ public:
     PathSet querySubstitutablePaths();
     
     bool hasSubstitutes(const Path & path);
+
+    bool querySubstitutablePathInfo(const Path & path,
+        SubstitutablePathInfo & info);
     
     Path addToStore(const Path & srcPath, bool fixed = false,
         bool recursive = false, string hashAlgo = "",
@@ -147,6 +167,9 @@ private:
     void tryToDelete(const GCOptions & options, GCResults & results,
         const PathSet & livePaths, const PathSet & tempRootsClosed, PathSet & done, 
         const Path & path);
+
+    void startSubstituter(const Path & substituter,
+        RunningSubstituter & runningSubstituter);
 };