#include <source-accessor.hh>
Classes | |
struct | Stat |
Public Types | |
enum | Type { tRegular , tSymlink , tDirectory , tChar , tBlock , tSocket , tFifo , tUnknown } |
typedef std::optional< Type > | DirEntry |
typedef std::map< std::string, DirEntry > | DirEntries |
Public Member Functions | |
virtual std::string | readFile (const CanonPath &path) |
virtual void | readFile (const CanonPath &path, Sink &sink, std::function< void(uint64_t)> sizeCallback=[](uint64_t size){}) |
virtual bool | pathExists (const CanonPath &path) |
Stat | lstat (const CanonPath &path) |
virtual std::optional< Stat > | maybeLstat (const CanonPath &path)=0 |
virtual DirEntries | readDirectory (const CanonPath &path)=0 |
virtual std::string | readLink (const CanonPath &path)=0 |
virtual void | dumpPath (const CanonPath &path, Sink &sink, PathFilter &filter=defaultPathFilter) |
Hash | hashPath (const CanonPath &path, PathFilter &filter=defaultPathFilter, HashAlgorithm ha=HashAlgorithm::SHA256) |
virtual std::optional< std::filesystem::path > | getPhysicalPath (const CanonPath &path) |
bool | operator== (const SourceAccessor &x) const |
auto | operator<=> (const SourceAccessor &x) const |
void | setPathDisplay (std::string displayPrefix, std::string displaySuffix="") |
virtual std::string | showPath (const CanonPath &path) |
CanonPath | resolveSymlinks (const CanonPath &path, SymlinkResolution mode=SymlinkResolution::Full) |
virtual std::optional< time_t > | getLastModified () |
Public Attributes | |
const size_t | number |
std::string | displayPrefix |
std::string | displaySuffix |
std::optional< std::string > | fingerprint |
A read-only filesystem abstraction. This is used by the Nix evaluator and elsewhere for accessing sources in various filesystem-like entities (such as the real filesystem, tarballs or Git repositories).
|
inlinevirtual |
Return the maximum last-modified time of the files in this tree, if available.
|
inlinevirtual |
Return a corresponding path in the root filesystem, if possible. This is only possible for filesystems that are materialized in the root filesystem.
Reimplemented in nix::FilteringSourceAccessor, and nix::PosixSourceAccessor.
|
pure virtual |
readFile
, this method should not follow symlinks. Implemented in nix::FilteringSourceAccessor, nix::GitSourceAccessor, nix::LocalStoreAccessor, nix::MemorySourceAccessor, nix::MountedSourceAccessor, nix::NarAccessor, nix::PosixSourceAccessor, and nix::RemoteFSAccessor.
|
virtual |
Return the contents of a file as a string.
Reimplemented in nix::FilteringSourceAccessor, nix::GitSourceAccessor, nix::MemorySourceAccessor, nix::MountedSourceAccessor, nix::NarAccessor, and nix::RemoteFSAccessor.
|
virtual |
Write the contents of a file as a sink. sizeCallback
must be called with the size of the file before any data is written to the sink.
readFile
, this method should not follow symlinks.SourceAccessor
need to implement at least one of the readFile()
variants. Reimplemented in nix::LocalStoreAccessor, and nix::PosixSourceAccessor.
CanonPath nix::SourceAccessor::resolveSymlinks | ( | const CanonPath & | path, |
SymlinkResolution | mode = SymlinkResolution::Full ) |
Resolve any symlinks in path
according to the given resolution mode.
mode | might only be a temporary solution for this. See the discussion in https://github.com/NixOS/nix/pull/9985. |
std::optional<std::string> nix::SourceAccessor::fingerprint |
A string that uniquely represents the contents of this accessor. This is used for caching lookups (see fetchToStore()
).