summary refs log tree commit diff
path: root/nix/libstore/local-store.hh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-01 15:55:57 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-08 22:30:08 +0100
commita618a8c6203d4cf57f12873a86797b8685b11e14 (patch)
treeb7b6eec5c5f387ccbaa8dfcd0859fa50047e6c8d /nix/libstore/local-store.hh
parent79c6614f58a57b985daf8940766319e440311db0 (diff)
downloadguix-a618a8c6203d4cf57f12873a86797b8685b11e14.tar.gz
daemon: Factorize substituter agent spawning.
* nix/libstore/local-store.hh (class LocalStore)[substituter]: New
method.
[runningSubstituter]: Turn into a shared_ptr.
* nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths):
Call 'substituter' instead of using inline code.
(LocalStore::querySubstitutablePathInfos): Likewise.
(LocalStore::substituter): New method.
Diffstat (limited to 'nix/libstore/local-store.hh')
-rw-r--r--nix/libstore/local-store.hh5
1 files changed, 4 insertions, 1 deletions
diff --git a/nix/libstore/local-store.hh b/nix/libstore/local-store.hh
index 57d15bac7e..9ba37219da 100644
--- a/nix/libstore/local-store.hh
+++ b/nix/libstore/local-store.hh
@@ -42,7 +42,10 @@ class LocalStore : public StoreAPI
 {
 private:
     /* The currently running substituter or empty.  */
-    std::unique_ptr<Agent> runningSubstituter;
+    std::shared_ptr<Agent> runningSubstituter;
+
+    /* Ensure the substituter is running and return it.  */
+    std::shared_ptr<Agent> substituter();
 
     Path linksDir;