about summary refs log tree commit diff
path: root/src/libstore/remote-store.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/remote-store.hh')
-rw-r--r--src/libstore/remote-store.hh95
1 files changed, 49 insertions, 46 deletions
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index 030120db4067..0757f82e8964 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <limits>
 #include <string>
 
 #include "store-api.hh"
@@ -12,94 +13,96 @@ class Pipe;
 class Pid;
 struct FdSink;
 struct FdSource;
+template<typename T> class Pool;
 
 
-class RemoteStore : public StoreAPI
+/* FIXME: RemoteStore is a misnomer - should be something like
+   DaemonStore. */
+class RemoteStore : public LocalFSStore
 {
 public:
 
-    RemoteStore();
-
-    ~RemoteStore();
+    RemoteStore(size_t maxConnections = std::numeric_limits<size_t>::max());
 
     /* Implementations of abstract store API methods. */
 
-    bool isValidPath(const Path & path);
-
-    PathSet queryValidPaths(const PathSet & paths);
+    std::string getUri() override;
 
-    PathSet queryAllValidPaths();
+    bool isValidPathUncached(const Path & path) override;
 
-    ValidPathInfo queryPathInfo(const Path & path);
+    PathSet queryValidPaths(const PathSet & paths) override;
 
-    Hash queryPathHash(const Path & path);
+    PathSet queryAllValidPaths() override;
 
-    void queryReferences(const Path & path, PathSet & references);
+    std::shared_ptr<ValidPathInfo> queryPathInfoUncached(const Path & path) override;
 
-    void queryReferrers(const Path & path, PathSet & referrers);
+    void queryReferrers(const Path & path, PathSet & referrers) override;
 
-    Path queryDeriver(const Path & path);
+    PathSet queryValidDerivers(const Path & path) override;
 
-    PathSet queryValidDerivers(const Path & path);
+    PathSet queryDerivationOutputs(const Path & path) override;
 
-    PathSet queryDerivationOutputs(const Path & path);
+    StringSet queryDerivationOutputNames(const Path & path) override;
 
-    StringSet queryDerivationOutputNames(const Path & path);
+    Path queryPathFromHashPart(const string & hashPart) override;
 
-    Path queryPathFromHashPart(const string & hashPart);
-
-    PathSet querySubstitutablePaths(const PathSet & paths);
+    PathSet querySubstitutablePaths(const PathSet & paths) override;
 
     void querySubstitutablePathInfos(const PathSet & paths,
-        SubstitutablePathInfos & infos);
+        SubstitutablePathInfos & infos) override;
+
+    void addToStore(const ValidPathInfo & info, const std::string & nar,
+        bool repair) override;
 
     Path addToStore(const string & name, const Path & srcPath,
         bool recursive = true, HashType hashAlgo = htSHA256,
-        PathFilter & filter = defaultPathFilter, bool repair = false);
+        PathFilter & filter = defaultPathFilter, bool repair = false) override;
 
     Path addTextToStore(const string & name, const string & s,
-        const PathSet & references, bool repair = false);
+        const PathSet & references, bool repair = false) override;
 
-    void exportPath(const Path & path, bool sign,
-        Sink & sink);
+    void buildPaths(const PathSet & paths, BuildMode buildMode) override;
 
-    Paths importPaths(bool requireSignature, Source & source);
+    BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv,
+        BuildMode buildMode) override;
 
-    void buildPaths(const PathSet & paths, BuildMode buildMode);
+    void ensurePath(const Path & path) override;
 
-    void ensurePath(const Path & path);
+    void addTempRoot(const Path & path) override;
 
-    void addTempRoot(const Path & path);
+    void addIndirectRoot(const Path & path) override;
 
-    void addIndirectRoot(const Path & path);
+    void syncWithGC() override;
 
-    void syncWithGC();
+    Roots findRoots() override;
 
-    Roots findRoots();
+    void collectGarbage(const GCOptions & options, GCResults & results) override;
 
-    void collectGarbage(const GCOptions & options, GCResults & results);
+    void optimiseStore() override;
 
-    PathSet queryFailedPaths();
+    bool verifyStore(bool checkContents, bool repair) override;
 
-    void clearFailedPaths(const PathSet & paths);
+    void addSignatures(const Path & storePath, const StringSet & sigs) override;
 
-    void optimiseStore();
-
-    bool verifyStore(bool checkContents, bool repair);
 private:
-    AutoCloseFD fdSocket;
-    FdSink to;
-    FdSource from;
-    unsigned int daemonVersion;
-    bool initialised;
 
-    void openConnection(bool reserveSpace = true);
+    struct Connection
+    {
+        AutoCloseFD fd;
+        FdSink to;
+        FdSource from;
+        unsigned int daemonVersion;
+
+        ~Connection();
+
+        void processStderr(Sink * sink = 0, Source * source = 0);
+    };
 
-    void processStderr(Sink * sink = 0, Source * source = 0);
+    ref<Pool<Connection>> connections;
 
-    void connectToDaemon();
+    ref<Connection> openConnection();
 
-    void setOptions();
+    void setOptions(ref<Connection> conn);
 };