aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/input-accessor.hh
blob: 740175af05868bbe5a316766edf76b26b3c8aa17 (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
34
35
#pragma once
///@file

#include "types.hh"
#include "archive.hh"

namespace nix {

struct InputAccessor
{
    enum Type {
      tRegular, tSymlink, tDirectory,
      /**
        Any other node types that may be encountered on the file system, such as device nodes, sockets, named pipe, and possibly even more exotic things.

        Responsible for `"unknown"` from `builtins.readFileType "/dev/null"`.

        Unlike `DT_UNKNOWN`, this must not be used for deferring the lookup of types.
      */
      tMisc
    };

    struct Stat
    {
        Type type = tMisc;
        //uint64_t fileSize = 0; // regular files only
        bool isExecutable = false; // regular files only
    };

    typedef std::optional<Type> DirEntry;

    typedef std::map<std::string, DirEntry> DirEntries;
};

}