Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nar-info.hh
Go to the documentation of this file.
1#pragma once
3
4#include "types.hh"
5#include "hash.hh"
6#include "path-info.hh"
7
8namespace nix {
9
10class Store;
11
12struct NarInfo : ValidPathInfo
13{
14 std::string url;
15 std::string compression;
16 std::optional<Hash> fileHash;
17 uint64_t fileSize = 0;
18
19 NarInfo() = delete;
20 NarInfo(const Store & store, std::string name, ContentAddressWithReferences ca, Hash narHash)
21 : ValidPathInfo(store, std::move(name), std::move(ca), narHash)
22 { }
23 NarInfo(StorePath path, Hash narHash) : ValidPathInfo(std::move(path), narHash) { }
24 NarInfo(const ValidPathInfo & info) : ValidPathInfo(info) { }
25 NarInfo(const Store & store, const std::string & s, const std::string & whence);
26
27 bool operator ==(const NarInfo &) const = default;
28 // TODO libc++ 16 (used by darwin) missing `std::optional::operator <=>`, can't do yet
29 //auto operator <=>(const NarInfo &) const = default;
30
31 std::string to_string(const Store & store) const;
32
33 nlohmann::json toJSON(
34 const Store & store,
35 bool includeImpureInfo,
36 HashFormat hashFormat) const override;
37 static NarInfo fromJSON(
38 const Store & store,
39 const StorePath & path,
40 const nlohmann::json & json);
41};
42
43}
Definition path.hh:27
Definition store-api.hh:169
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
return s
Definition lexer.l:459
virtual nlohmann::json toJSON()=0
const std::string_view & name
Definition lexer.l:1709
HashFormat
Enumeration representing the hash formats.
Definition hash.hh:29
Definition content-address.hh:276
Definition hash.hh:45
std::optional< ContentAddress > ca
Definition path-info.hh:102
Hash narHash
Definition path-info.hh:51