Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
path-info.hh
Go to the documentation of this file.
1#pragma once
3
6#include "lix/libutil/hash.hh"
8
9#include <string>
10#include <optional>
11
12namespace nix {
13
14
15class Store;
16
17
19{
20 std::optional<StorePath> deriver;
21 StorePathSet references;
25 uint64_t downloadSize;
29 uint64_t narSize;
30};
31
32using SubstitutablePathInfos = std::map<StorePath, SubstitutablePathInfo>;
33
34
35struct UnkeyedValidPathInfo
36{
37 std::optional<StorePath> deriver;
42 StorePathSet references;
43 time_t registrationTime = 0;
44 uint64_t narSize = 0; // 0 = unknown
45 uint64_t id = 0; // internal use only
46
51 bool ultimate = false;
52
53 StringSet sigs; // note: not necessarily verified
54
72 std::optional<ContentAddress> ca;
73
74 UnkeyedValidPathInfo(const UnkeyedValidPathInfo & other) = default;
75
76 UnkeyedValidPathInfo(Hash narHash) : narHash(narHash) { };
77
79
80 virtual ~UnkeyedValidPathInfo() { }
81};
82
83struct ValidPathInfo : UnkeyedValidPathInfo {
84 StorePath path;
85
86 DECLARE_CMP(ValidPathInfo);
87
96 std::string fingerprint(const Store & store) const;
97
98 void sign(const Store & store, const SecretKey & secretKey);
99
105 std::optional<ContentAddressWithReferences> contentAddressWithReferences() const;
106
110 bool isContentAddressed(const Store & store) const;
111
112 static const size_t maxSigs = std::numeric_limits<size_t>::max();
113
119 size_t checkSignatures(const Store & store, const PublicKeys & publicKeys) const;
120
124 bool checkSignature(const Store & store, const PublicKeys & publicKeys, const std::string & sig) const;
125
126 Strings shortRefs() const;
127
128 ValidPathInfo(const ValidPathInfo & other) = default;
129
130 ValidPathInfo(StorePath && path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(std::move(path)) { };
131 ValidPathInfo(const StorePath & path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(path) { };
132
133 ValidPathInfo(const Store & store,
134 std::string_view name, ContentAddressWithReferences && ca, Hash narHash);
135
136 virtual ~ValidPathInfo() { }
137};
138
139using ValidPathInfos = std::map<StorePath, ValidPathInfo>;
140
141}
Definition path.hh:21
Definition store-api.hh:195
#define DECLARE_CMP(my_type)
Definition comparator.hh:33
Definition content-address.hh:242
Definition hash.hh:41
Definition crypto.hh:31
Definition path-info.hh:19
uint64_t downloadSize
Definition path-info.hh:25
uint64_t narSize
Definition path-info.hh:29
Definition path-info.hh:36
std::optional< ContentAddress > ca
Definition path-info.hh:72
bool ultimate
Definition path-info.hh:51
Hash narHash
Definition path-info.hh:41
bool checkSignature(const Store &store, const PublicKeys &publicKeys, const std::string &sig) const
Definition path-info.cc:106
std::string fingerprint(const Store &store) const
Definition path-info.cc:26
size_t checkSignatures(const Store &store, const PublicKeys &publicKeys) const
Definition path-info.cc:94
bool isContentAddressed(const Store &store) const
Definition path-info.cc:76
std::optional< ContentAddressWithReferences > contentAddressWithReferences() const
Definition path-info.cc:44