Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
posix-source-accessor.hh
1#pragma once
2
3#include "source-accessor.hh"
4
5namespace nix {
6
7struct SourcePath;
8
12struct PosixSourceAccessor : virtual SourceAccessor
13{
19 const std::filesystem::path root;
20
21 PosixSourceAccessor();
22 PosixSourceAccessor(std::filesystem::path && root);
23
28 time_t mtime = 0;
29
30 void readFile(
31 const CanonPath & path,
32 Sink & sink,
33 std::function<void(uint64_t)> sizeCallback) override;
34
35 bool pathExists(const CanonPath & path) override;
36
37 std::optional<Stat> maybeLstat(const CanonPath & path) override;
38
39 DirEntries readDirectory(const CanonPath & path) override;
40
41 std::string readLink(const CanonPath & path) override;
42
43 std::optional<std::filesystem::path> getPhysicalPath(const CanonPath & path) override;
44
70 static SourcePath createAtRoot(const std::filesystem::path & path);
71
72private:
73
77 void assertNoSymlinks(CanonPath path);
78
79 std::optional<struct stat> cachedLstat(const CanonPath & path);
80
81 std::filesystem::path makeAbsPath(const CanonPath & path);
82};
83
84}
Definition canon-path.hh:41
std::optional< SourceAccessor::Stat > maybeLstat() const
std::optional< std::filesystem::path > getPhysicalPath() const
std::string readFile() const
std::string readLink() const
SourceAccessor::DirEntries readDirectory() const
bool pathExists() const
time_t mtime
Definition posix-source-accessor.hh:28
const std::filesystem::path root
Definition posix-source-accessor.hh:19
static SourcePath createAtRoot(const std::filesystem::path &path)
Definition posix-source-accessor.cc:21
Definition serialise.hh:20
Definition source-path.hh:22