aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-01-03 14:51:23 +0100
committerEelco Dolstra <edolstra@gmail.com>2023-01-03 14:51:23 +0100
commit224b56f10e1bb754d403c106eb9d1b947fc30414 (patch)
tree5bc37fcd2349236a71d9f5139bd26ece5580b6a8 /src/libstore/local-store.hh
parent15341334b50b2b432830a8e78abc331d0a47de13 (diff)
Move creation of the temp roots file into its own function
This also moves the file handle into its own Sync object so we're not holding the _state while acquiring the file lock. There was no real deadlock risk here since locking a newly created file cannot block, but it's still a bit nicer.
Diffstat (limited to 'src/libstore/local-store.hh')
-rw-r--r--src/libstore/local-store.hh12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 4579c2f62..9ea0c0bf7 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -62,9 +62,6 @@ private:
/* The global GC lock */
AutoCloseFD fdGCLock;
- /* The file to which we write our temporary roots. */
- AutoCloseFD fdTempRoots;
-
/* Connection to the garbage collector. */
AutoCloseFD fdRootsSocket;
@@ -156,6 +153,15 @@ public:
void addTempRoot(const StorePath & path) override;
+private:
+
+ void createTempRootsFile();
+
+ /* The file to which we write our temporary roots. */
+ Sync<AutoCloseFD> _fdTempRoots;
+
+public:
+
void addIndirectRoot(const Path & path) override;
private: