From 89e99d94e4ae492db09c0ebc0c35e4890ef7db25 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 6 Mar 2024 05:24:35 +0100 Subject: Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos Combine `AbstractPos`, `PosAdapter`, and `Pos` (cherry picked from commit 113499d16fc87d53b73fb62fe6242154909756ed) === this is a bit cursed because originally it was based on InputAccessor code that we don't have and moved/patched features we likewise don't have (fetchToStore caching, all the individual accessors, ContentAddressMethod). the commit is adjusted accordingly to match (remove caching, ignore accessors, use FileIngestionMethod). note that `state.rootPath . CanonPath == abs` and computeStorePathForPath works relative to cwd, so the slight rewrite in the moved fetchToStore is legal. Change-Id: I05fd340c273f0bcc8ffabfebdc4a88b98083bce5 --- src/libutil/input-accessor.hh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/libutil/input-accessor.hh (limited to 'src/libutil/input-accessor.hh') diff --git a/src/libutil/input-accessor.hh b/src/libutil/input-accessor.hh new file mode 100644 index 000000000..740175af0 --- /dev/null +++ b/src/libutil/input-accessor.hh @@ -0,0 +1,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 DirEntry; + + typedef std::map DirEntries; +}; + +} -- cgit v1.2.3