aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/eval-cache.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-11 12:12:59 +0200
committerGitHub <noreply@github.com>2019-06-11 12:12:59 +0200
commitc4d740115e391335361eaf9706b75f303a4b8002 (patch)
tree4d48be5b00e80d65fb80c32394526b7cc3137bcd /src/libexpr/flake/eval-cache.hh
parent671f16aee04a2457f22156873e65715b8c4aa8a9 (diff)
parentc47d2dac6c7b404714e4c3429f26791790a483f5 (diff)
Merge pull request #2930 from NixOS/eval-cache
Flake evaluation cache
Diffstat (limited to 'src/libexpr/flake/eval-cache.hh')
-rw-r--r--src/libexpr/flake/eval-cache.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/libexpr/flake/eval-cache.hh b/src/libexpr/flake/eval-cache.hh
new file mode 100644
index 000000000..03aea142e
--- /dev/null
+++ b/src/libexpr/flake/eval-cache.hh
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "sync.hh"
+#include "flake.hh"
+
+namespace nix { struct SQLite; struct SQLiteStmt; }
+
+namespace nix::flake {
+
+class EvalCache
+{
+ struct State;
+
+ std::unique_ptr<Sync<State>> _state;
+
+ EvalCache();
+
+public:
+
+ struct Derivation
+ {
+ Path drvPath;
+ Path outPath;
+ std::string outputName;
+ };
+
+ void addDerivation(
+ const Fingerprint & fingerprint,
+ const std::string & attrPath,
+ const Derivation & drv);
+
+ std::optional<Derivation> getDerivation(
+ const Fingerprint & fingerprint,
+ const std::string & attrPath);
+
+ static EvalCache & singleton();
+};
+
+}