aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tree-info.hh
blob: 3b62151c6e8a66b4309071610e7a4d4859859ca1 (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
#pragma once

#include "path.hh"
#include "hash.hh"

#include <nlohmann/json_fwd.hpp>

namespace nix { class Store; }

namespace nix::fetchers {

struct TreeInfo
{
    Hash narHash;
    std::optional<uint64_t> revCount;
    std::optional<time_t> lastModified;

    bool operator ==(const TreeInfo & other) const
    {
        return
            narHash == other.narHash
            && revCount == other.revCount
            && lastModified == other.lastModified;
    }

    StorePath computeStorePath(Store & store) const;

    static TreeInfo fromJson(const nlohmann::json & json);

    nlohmann::json toJson() const;
};

}