aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/eval-cache.hh
blob: 03aea142ea43ceabd74ab26a1e193ba3b179c411 (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
#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();
};

}