about summary refs log tree commit diff
path: root/src/libstore/remote-store.hh
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-02T18·15-0400
committerShea Levy <shea@shealevy.com>2016-09-02T18·15-0400
commit0f3963329018d9cf930e2a0e2b0ec2f4e26b40b3 (patch)
tree2c65d993ae9407d405255f9a4f0866ade165194d /src/libstore/remote-store.hh
parent7d4ccd9b17ca902438e7045e4ce950525ed554b6 (diff)
Factor out the unix domain socket-specific code from RemoteStore
Diffstat (limited to 'src/libstore/remote-store.hh')
-rw-r--r--src/libstore/remote-store.hh33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index e756805ea05b..a69a4f2a3b8b 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -18,7 +18,7 @@ template<typename T> class Pool;
 
 /* FIXME: RemoteStore is a misnomer - should be something like
    DaemonStore. */
-class RemoteStore : public LocalFSStore
+class RemoteStore : public virtual Store
 {
 public:
 
@@ -26,8 +26,6 @@ public:
 
     /* Implementations of abstract store API methods. */
 
-    std::string getUri() override;
-
     bool isValidPathUncached(const Path & path) override;
 
     PathSet queryValidPaths(const PathSet & paths) override;
@@ -84,11 +82,10 @@ public:
 
     void addSignatures(const Path & storePath, const StringSet & sigs) override;
 
-private:
+protected:
 
     struct Connection
     {
-        AutoCloseFD fd;
         FdSink to;
         FdSource from;
         unsigned int daemonVersion;
@@ -98,11 +95,33 @@ private:
         void processStderr(Sink * sink = 0, Source * source = 0);
     };
 
+    virtual ref<Connection> openConnection() = 0;
+
+    void setOptions(Connection & conn);
+
+    void initConnection(Connection & conn);
+
+private:
+
     ref<Pool<Connection>> connections;
+};
 
-    ref<Connection> openConnection();
+class UDSRemoteStore : public LocalFSStore, public RemoteStore
+{
+public:
+
+    UDSRemoteStore(const Params & params, size_t maxConnections = std::numeric_limits<size_t>::max());
+
+    std::string getUri() override;
+
+private:
+
+    struct Connection : RemoteStore::Connection
+    {
+        AutoCloseFD fd;
+    };
 
-    void setOptions(ref<Connection> conn);
+    ref<RemoteStore::Connection> openConnection() override;
 };