aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/eval-cache.hh
blob: f81d48ba596337849fc5f54f13c0ce3c45f43fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "sync.hh"
#include "flake.hh"
#include "path.hh"

namespace nix { struct SQLite; struct SQLiteStmt; }

namespace nix::flake {

class EvalCache
{
    struct State;

    std::unique_ptr<Sync<State>> _state;

    EvalCache();

public:

    struct Derivation
    {
        StorePath drvPath;
        StorePath 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();
};

}