Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
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"
9
10namespace nix {
11
12using RawMode = uint32_t;
13
14namespace merkle {
15
20enum struct Mode : RawMode {
21 Directory = 0040000,
22 Regular = 0100644,
23 Executable = 0100755,
24 Symlink = 0120000,
25};
26
27inline 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
44{
45 Mode mode;
46 Hash hash;
47
48 bool operator==(const TreeEntry &) const = default;
49 auto operator<=>(const TreeEntry &) const = default;
50};
51
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
Mode
Definition merkle-files.hh:20
Definition hash.hh:58
Definition merkle-files.hh:57
virtual void insertChild(std::string_view name, TreeEntry entry)=0
Definition merkle-files.hh:44