18template<
typename RegularContents>
21 bool executable =
false;
22 RegularContents contents;
24 auto operator<=>(
const Regular &)
const =
default;
31template<
typename Child>
34 using Name = std::string;
36 std::map<Name, Child, std::less<>> entries;
38 inline bool operator==(
const DirectoryT &)
const noexcept;
39 inline std::strong_ordering operator<=>(
const DirectoryT &)
const noexcept;
46 auto operator<=>(
const Symlink &)
const =
default;
57 auto operator<=>(
const Opaque &)
const =
default;
67template<
typename RegularContents,
bool recur>
70 bool operator==(
const VariantT &)
const noexcept;
71 std::strong_ordering operator<=>(
const VariantT &)
const noexcept;
82 using Raw = std::variant<Regular, Directory, Symlink>;
90template<
typename Child>
91inline bool DirectoryT<Child>::operator==(
const DirectoryT &)
const noexcept =
default;
93template<
typename Child>
94inline std::strong_ordering DirectoryT<Child>::operator<=>(
const DirectoryT &)
const noexcept =
default;
96template<
typename RegularContents,
bool recur>
100template<
typename RegularContents,
bool recur>
101inline std::strong_ordering
112 void anchor()
override;
117 std::optional<File> root;
123 return root < other.root;
130 std::optional<Stat> maybeLstat(
const CanonPath & path)
override;
132 std::string readLink(
const CanonPath & path)
override;
145 File *
open(
const CanonPath & path, std::optional<File> create);
160 void anchor()
override;
170 void createDirectory(
const CanonPath & path)
override;
174 void createSymlink(
const CanonPath & path,
const std::string & target)
override;
182struct json_avoids_null<MemorySourceAccessor::
File::Directory> : std::true_type
201#define ARG nix::fso::Regular<RegularContents>
202template<
typename RegularContents>
206#define ARG nix::fso::DirectoryT<Child>
207template<
typename Child>
212JSON_IMPL_INNER(nix::fso::Symlink);
215JSON_IMPL_INNER(nix::fso::Opaque);
217#define ARG nix::fso::VariantT<RegularContents, recur>
218template<
typename RegularContents,
bool recur>
Definition canon-path.hh:50
Definition memory-source-accessor.hh:16
void createRegularFile(const CanonPath &path, fun< void(CreateRegularFileSink &)>) override
Definition memory-source-accessor.cc:216
Definition memory-source-accessor.hh:110
DirEntries readDirectory(const CanonPath &path) override
Definition memory-source-accessor.cc:127
bool pathExists(const CanonPath &path) override
Check whether a file exists at path.
Definition memory-source-accessor.cc:90
File * open(const CanonPath &path, std::optional< File > create)
Definition memory-source-accessor.cc:11
SourcePath addFile(CanonPath path, std::string &&contents)
Insert a new regular file into with the specified contents.
Definition memory-source-accessor.cc:161
void readFile(const CanonPath &path, Sink &sink, fun< void(uint64_t)> sizeCallback) override
Definition memory-source-accessor.cc:72
Definition serialise.hh:18
Definition source-accessor.hh:119
std::string readFile(const CanonPath &path)
Definition source-accessor.cc:62
Definition source-path.hh:22
Definition memory-source-accessor.hh:33
Definition memory-source-accessor.hh:56
Definition memory-source-accessor.hh:20
Definition memory-source-accessor.hh:43
Definition memory-source-accessor.hh:69
nix::fso::DirectoryT< std::conditional_t< recur, VariantT, Opaque > > Directory
Definition memory-source-accessor.hh:78