Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
merkle-files.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include <cstdint>
5
#include <optional>
6
7
#include "
nix/util/hash.hh
"
8
#include "
nix/util/serialise.hh
"
9
10
namespace
nix {
11
12
using
RawMode = uint32_t;
13
14
namespace
merkle {
15
20
enum struct
Mode
: RawMode {
21
Directory = 0040000,
22
Regular = 0100644,
23
Executable = 0100755,
24
Symlink = 0120000,
25
};
26
27
inline
std::optional<Mode> decodeMode(RawMode m)
28
{
29
switch
(m) {
30
case
(RawMode) Mode::Directory:
31
case
(RawMode) Mode::Executable:
32
case
(RawMode) Mode::Regular:
33
case
(RawMode) Mode::Symlink:
34
return
(Mode) m;
35
default
:
36
return
std::nullopt;
37
}
38
}
39
43
struct
TreeEntry
44
{
45
Mode
mode;
46
Hash
hash;
47
48
bool
operator==(
const
TreeEntry
&)
const
=
default
;
49
auto
operator<=>(
const
TreeEntry
&)
const
=
default
;
50
};
51
56
struct
DirectorySink
57
{
58
virtual
~DirectorySink
();
59
63
virtual
void
insertChild
(std::string_view name,
TreeEntry
entry) = 0;
64
};
65
66
}
// namespace merkle
67
68
}
// namespace nix
hash.hh
nix::merkle::Mode
Mode
Definition
merkle-files.hh:20
serialise.hh
nix::Hash
Definition
hash.hh:58
nix::merkle::DirectorySink
Definition
merkle-files.hh:57
nix::merkle::DirectorySink::insertChild
virtual void insertChild(std::string_view name, TreeEntry entry)=0
nix::merkle::TreeEntry
Definition
merkle-files.hh:44
libutil
include
nix
util
merkle-files.hh
Generated by
1.18.0