Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::RemoteFSAccessor Class Reference
Inheritance diagram for nix::RemoteFSAccessor:
nix::SourceAccessor

Public Member Functions

std::shared_ptr< SourceAccessor > accessObject (const StorePath &path)
 RemoteFSAccessor (ref< Store > store, bool requireValidPath=true, std::optional< AbsolutePath > cacheDir={})
std::optional< Stat > maybeLstat (const CanonPath &path) override
DirEntries readDirectory (const CanonPath &path) override
void readFile (const CanonPath &path, Sink &sink, fun< void(uint64_t)> sizeCallback) override
std::string readLink (const CanonPath &path) override
std::string readFile (const CanonPath &path)
Public Member Functions inherited from nix::SourceAccessor
std::string readFile (const CanonPath &path)
virtual bool pathExists (const CanonPath &path)
 Check whether a file exists at path.
virtual Stat lstat (const CanonPath &path)
virtual void readDirectory (const CanonPath &dirPath, std::function< void(SourceAccessor &subdirAccessor, const CanonPath &subdirRelPath)> callback)
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)
 Render a human-readable representation of the accessor + path beneath it.
CanonPath resolveSymlinks (const CanonPath &path, SymlinkResolution mode=SymlinkResolution::Full)
virtual std::pair< CanonPath, std::optional< std::string > > getFingerprint (const CanonPath &path)
virtual std::optional< time_t > getLastModified ()
virtual void invalidateCache ()

Friends

struct BinaryCacheStore

Additional Inherited Members

Public Types inherited from nix::SourceAccessor
enum  Type {
  tRegular , tSymlink , tDirectory , tChar ,
  tBlock , tSocket , tFifo , tUnknown
}
typedef std::optional< Type > DirEntry
typedef std::map< std::string, DirEntry > DirEntries
Public Attributes inherited from nix::SourceAccessor
const size_t number
std::string displayPrefix
std::string displaySuffix
std::optional< std::string > fingerprint

Member Function Documentation

◆ accessObject()

std::shared_ptr< SourceAccessor > nix::RemoteFSAccessor::accessObject ( const StorePath & path)
Returns
nullptr if the store does not contain any object at that path.
Todo
This actually doesn't return nullptr, but throws on invalid paths.

◆ maybeLstat()

std::optional< SourceAccessor::Stat > nix::RemoteFSAccessor::maybeLstat ( const CanonPath & path)
overridevirtual

Implements nix::SourceAccessor.

◆ readDirectory()

SourceAccessor::DirEntries nix::RemoteFSAccessor::readDirectory ( const CanonPath & path)
overridevirtual
Note
Like readFile, this method should not follow symlinks.

Implements nix::SourceAccessor.

◆ readFile() [1/2]

std::string nix::SourceAccessor::readFile ( const CanonPath & path)

Return the contents of a file as a string.

Note
Unlike Unix, this method should not follow symlinks. Nix by default wants to manipulate symlinks explicitly, and not implicitly follow them, as they are frequently untrusted user data and thus may point to arbitrary locations. Acting on the targets targets of symlinks should only occasionally be done, and only with care.

◆ readFile() [2/2]

void nix::RemoteFSAccessor::readFile ( const CanonPath & path,
Sink & sink,
fun< void(uint64_t)> sizeCallback )
overridevirtual

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.

Note
Like the other readFile, this method should not follow symlinks.
subclasses of SourceAccessor need to implement at least one of the readFile() variants.

Implements nix::SourceAccessor.

◆ readLink()

std::string nix::RemoteFSAccessor::readLink ( const CanonPath & path)
overridevirtual

Implements nix::SourceAccessor.


The documentation for this class was generated from the following files: