Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::GitSourceAccessor Struct Referencefinal
Inheritance diagram for nix::GitSourceAccessor:
nix::SourceAccessor

Classes

struct  State
struct  Submodule

Public Member Functions

 GitSourceAccessor (ref< GitRepoImpl > repo_, const Hash &rev, const GitAccessorOptions &options)
void readBlob (const CanonPath &path, bool symlink, Sink &sink, std::function< void(uint64_t)> sizeCallback)
void readFile (const CanonPath &path, Sink &sink, fun< void(uint64_t)> sizeCallback) override
bool pathExists (const CanonPath &path) override
 Check whether a file exists at path.
std::optional< Stat > maybeLstat (const CanonPath &path) override
DirEntries readDirectory (const CanonPath &path) override
std::string readLink (const CanonPath &path) override
std::optional< Hash > getSubmoduleRev (const CanonPath &path)
git_tree_entry * lookup (State &state, const CanonPath &path)
Tree lookupTree (State &state, const CanonPath &path)
git_tree_entry * need (State &state, const CanonPath &path)
std::variant< Tree, Submodule > getTree (State &state, const CanonPath &path)
Blob getBlob (State &state, const CanonPath &path, bool expectSymlink)
Public Member Functions inherited from nix::SourceAccessor
std::string readFile (const CanonPath &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 ()

Public Attributes

Sync< State > state_
Public Attributes inherited from nix::SourceAccessor
const size_t number
std::string displayPrefix
std::string displaySuffix
std::optional< std::string > fingerprint

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

Detailed Description

Raw git tree input accessor.

Member Function Documentation

◆ getSubmoduleRev()

std::optional< Hash > nix::GitSourceAccessor::getSubmoduleRev ( const CanonPath & path)
inline

If path exists and is a submodule, return its revision. Otherwise return nothing.

◆ lookup()

git_tree_entry * nix::GitSourceAccessor::lookup ( State & state,
const CanonPath & path )
inline

Recursively look up 'path' relative to the root.

Also adds all tree siblings (if the parent itself exists) to the lookupCache.

Returns
Non-owning handle of the entry. It lives as long as *this.

◆ maybeLstat()

std::optional< Stat > nix::GitSourceAccessor::maybeLstat ( const CanonPath & path)
inlineoverridevirtual

Implements nix::SourceAccessor.

◆ pathExists()

bool nix::GitSourceAccessor::pathExists ( const CanonPath & path)
inlineoverridevirtual

Check whether a file exists at path.

Todo
Consider making this non-virtual, since the evaluator uses maybeLstat as an indication that a file exists always (for positive caching purposes).

Reimplemented from nix::SourceAccessor.

◆ readDirectory()

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

Implements nix::SourceAccessor.

◆ readFile()

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

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::GitSourceAccessor::readLink ( const CanonPath & path)
inlineoverridevirtual

Implements nix::SourceAccessor.


The documentation for this struct was generated from the following file:
  • libfetchers/git-utils.cc