Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::LegacySSHStore Struct Reference
Inheritance diagram for nix::LegacySSHStore:
nix::Store nix::StoreDirConfig

Classes

struct  ConnectionStats
struct  Connection

Public Types

using Config = LegacySSHStoreConfig
Public Types inherited from nix::Store
using Config = StoreConfig
using PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>>

Public Member Functions

 LegacySSHStore (ref< const Config >)
ref< Connection > openConnection ()
void queryPathInfoUncached (const StorePath &path, Callback< std::shared_ptr< const ValidPathInfo > > callback) noexcept override
std::map< StorePath, UnkeyedValidPathInfo > queryPathInfosUncached (const StorePathSet &paths)
void addToStore (const ValidPathInfo &info, Source &source, RepairFlag repair, CheckSigsFlag checkSigs) override
void narFromPath (const StorePath &path, Sink &sink) override
void narFromPath (const StorePath &path, fun< void(Source &)> receiveNar)
std::optional< StorePath > queryPathFromHashPart (const std::string &hashPart) override
StorePath addToStore (std::string_view name, const SourcePath &path, ContentAddressMethod method, HashAlgorithm hashAlgo, const StorePathSet &references, PathFilter &filter, RepairFlag repair) override
StorePath addToStoreFromDump (Source &dump, std::string_view name, FileSerialisationMethod dumpMethod=FileSerialisationMethod::NixArchive, ContentAddressMethod hashMethod=FileIngestionMethod::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references=StorePathSet(), RepairFlag repair=NoRepair) override
void registerDrvOutputUnchecked (const Realisation &output) override
ref< Builder > getBuilder (std::shared_ptr< Store > evalStore) override
ref< SourceAccessor > getFSAccessor (bool requireValidPath) override
std::shared_ptr< SourceAccessor > getFSAccessor (const StorePath &path, bool requireValidPath) override
void computeFSClosure (const StorePathSet &paths, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false) override
StorePathSet queryValidPaths (const StorePathSet &paths, SubstituteFlag maybeSubstitute=NoSubstitute) override
StorePathSet queryValidPaths (const StorePathSet &paths, bool lock, SubstituteFlag maybeSubstitute=NoSubstitute)
void connect () override
unsigned int getProtocol () override
ConnectionStats getConnectionStats ()
pid_t getConnectionPid ()
std::optional< TrustedFlag > isTrustedClient () override
void queryRealisationUncached (const DrvOutput &, Callback< std::shared_ptr< const UnkeyedRealisation > > callback) noexcept override
StorePathSet querySubstitutablePaths (const StorePathSet &paths) override
Public Member Functions inherited from nix::Store
 operator const Config & () const
virtual void init ()
std::filesystem::path followLinksToStore (std::string_view path) const
StorePath followLinksToStorePath (std::string_view path) const
bool isValidPath (const StorePath &path)
void substitutePaths (const StorePathSet &paths)
virtual StorePathSet queryAllValidPaths ()
ref< const ValidPathInfo > queryPathInfo (const StorePath &path)
void queryPathInfo (const StorePath &path, Callback< ref< const ValidPathInfo > > callback) noexcept
std::optional< std::shared_ptr< const ValidPathInfo > > queryPathInfoFromClientCache (const StorePath &path)
std::shared_ptr< const UnkeyedRealisation > queryRealisation (const DrvOutput &)
void queryRealisation (const DrvOutput &, Callback< std::shared_ptr< const UnkeyedRealisation > > callback) noexcept
virtual bool pathInfoIsUntrusted (const ValidPathInfo &)
virtual bool realisationIsUntrusted (const Realisation &)
virtual void queryReferrers (const StorePath &path, StorePathSet &referrers)
virtual StorePathSet queryValidDerivers (const StorePath &path)
virtual StorePathSet queryDerivationOutputs (const StorePath &path)
virtual std::map< std::string, std::optional< StorePath > > queryPartialDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr)
virtual std::map< std::string, std::optional< StorePath > > queryStaticPartialDerivationOutputMap (const StorePath &path)
virtual std::optional< StorePath > queryStaticPartialDerivationOutput (const StorePath &path, const std::string &outputName)
OutputPathMap queryDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr)
virtual void querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos)
virtual void addMultipleToStore (PathsSource &&pathsToCopy, Activity &act, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)
ValidPathInfo addToStoreSlow (std::string_view name, const SourcePath &path, ContentAddressMethod method=ContentAddressMethod::Raw::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references=StorePathSet(), std::optional< Hash > expectedCAHash={})
virtual void registerDrvOutput (const Realisation &output, CheckSigsFlag checkSigs)
virtual void addTempRoot (const StorePath &path)
virtual void addTempRoots (const StorePathSet &paths)
std::string makeValidityRegistration (const StorePathSet &paths, bool showDerivers, bool showHash)
virtual void optimiseStore ()
virtual bool verifyStore (bool checkContents, RepairFlag repair=NoRepair)
ref< SourceAccessor > requireStoreObjectAccessor (const StorePath &path, bool requireValidPath=true)
virtual void addSignatures (const StorePath &storePath, const std::set< Signature > &sigs)
void signPathInfo (ValidPathInfo &info)
void signRealisation (Realisation &)
Derivation derivationFromPath (const StorePath &drvPath)
virtual StorePath writeDerivation (const Derivation &drv, RepairFlag repair=NoRepair)
virtual Derivation readDerivation (const StorePath &drvPath)
virtual Derivation readInvalidDerivation (const StorePath &drvPath)
void computeFSClosure (const StorePath &path, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
virtual MissingPaths queryMissing (const std::vector< DerivedPath > &targets)
virtual StorePaths topoSortPaths (const StorePathSet &paths)
StorePathSet exportReferences (const StorePathSet &storePaths, const StorePathSet &inputPaths)
std::optional< StorePath > getBuildDerivationPath (const StorePath &)
void clearPathInfoCache ()
virtual void setOptions ()
virtual std::optional< std::string > getVersion ()
Public Member Functions inherited from nix::StoreDirConfig
StorePath parseStorePath (std::string_view path) const
StorePath parseStorePathCanonical (std::string_view path) const
std::optional< StorePath > maybeParseStorePath (std::string_view path) const
std::string printStorePath (const StorePath &path) const
StringSet printStorePathSet (const StorePathSet &path) const
std::size_t maxCanonicalStorePathLen () const noexcept
bool isInStore (std::string_view path) const
bool isStorePath (std::string_view path) const
std::pair< StorePath, CanonPath > toStorePath (std::string_view path) const
StorePath makeStorePath (std::string_view type, std::string_view hash, std::string_view name) const
StorePath makeStorePath (std::string_view type, const Hash &hash, std::string_view name) const
StorePath makeOutputPath (std::string_view id, const Hash &hash, std::string_view name) const
StorePath makeFixedOutputPath (std::string_view name, const FixedOutputInfo &info) const
StorePath makeFixedOutputPathFromCA (std::string_view name, const ContentAddressWithReferences &ca) const
std::pair< StorePath, Hash > computeStorePath (std::string_view name, const SourcePath &path, ContentAddressMethod method=ContentAddressMethod::Raw::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references={}, PathFilter &filter=defaultPathFilter) const

Public Attributes

ref< const Config > config
ref< Pool< Connection > > connections
SSHMaster master
Public Attributes inherited from nix::Store
const Config & config
Public Attributes inherited from nix::StoreDirConfig
const std::string & storeDir

Friends

struct LegacySSHBuilder

Additional Inherited Members

Static Public Attributes inherited from nix::Store
static constexpr const char * MissingName = "x"
Protected Member Functions inherited from nix::Store
void invalidatePathInfoCacheFor (const StorePath &path)
 Store (const Store::Config &config)
virtual bool isValidPathUncached (const StorePath &path)
void unsupported (const std::string &op)
Protected Attributes inherited from nix::Store
std::shared_ptr< SharedSync< LRUCache< StorePath, PathInfoCacheValue > > > pathInfoCache
std::shared_ptr< NarInfoDiskCache > diskCache

Member Function Documentation

◆ addToStore() [1/2]

void nix::LegacySSHStore::addToStore ( const ValidPathInfo & info,
Source & narSource,
RepairFlag repair,
CheckSigsFlag checkSigs )
overridevirtual

Import a path into the store. Note that the entire NAR may not be read from narSource, e.g. if the path is already valid.

Implements nix::Store.

◆ addToStore() [2/2]

StorePath nix::LegacySSHStore::addToStore ( std::string_view name,
const SourcePath & path,
ContentAddressMethod method,
HashAlgorithm hashAlgo,
const StorePathSet & references,
PathFilter & filter,
RepairFlag repair )
inlineoverridevirtual

Copy the contents of a path to the store and register the validity the resulting path.

Returns
The resulting path is returned.
Parameters
filterThis function can be used to exclude files (see libutil/archive.hh).

Reimplemented from nix::Store.

◆ addToStoreFromDump()

StorePath nix::LegacySSHStore::addToStoreFromDump ( Source & dump,
std::string_view name,
FileSerialisationMethod dumpMethod = FileSerialisationMethod::NixArchive,
ContentAddressMethod hashMethod = FileIngestionMethod::NixArchive,
HashAlgorithm hashAlgo = HashAlgorithm::SHA256,
const StorePathSet & references = StorePathSet(),
RepairFlag repair = NoRepair )
inlineoverridevirtual

Like addToStore(), but the contents of the path are contained in dump, which is either a NAR serialisation (if recursive == true) or simply the contents of a regular file (if recursive == false).

dump may be drained.

Parameters
dumpMethodWhat serialisation format is dump, i.e. how to deserialize it. Must either match hashMethod or be FileSerialisationMethod::NixArchive.
hashMethodHow content addressing? Need not match be the same as dumpMethod.
Todo
remove?

Implements nix::Store.

◆ computeFSClosure()

void nix::LegacySSHStore::computeFSClosure ( const StorePathSet & paths,
StorePathSet & out,
bool flipDirection = false,
bool includeOutputs = false,
bool includeDerivers = false )
overridevirtual
Parameters
[out]outPlace in here the set of all store paths in the file system closure of storePath; that is, all paths than can be directly or indirectly reached from it. out is not cleared.
flipDirectionIf true, the set of paths that can reach storePath is returned; that is, the closures under the referrers relation instead of the references relation is returned.

Reimplemented from nix::Store.

◆ connect()

void nix::LegacySSHStore::connect ( )
overridevirtual

Establish a connection to the store, for store types that have a notion of connection. Otherwise this is a no-op.

Reimplemented from nix::Store.

◆ getBuilder()

ref< Builder > nix::LegacySSHStore::getBuilder ( std::shared_ptr< Store > evalStore)
overridevirtual

Get a Builder for this store.

Parameters
evalStoreIf provided and different from this store, derivation files will be copied from the eval store to this store before building.

Reimplemented from nix::Store.

◆ getFSAccessor() [1/2]

ref< SourceAccessor > nix::LegacySSHStore::getFSAccessor ( bool requireValidPath)
inlineoverridevirtual
Returns
An object to access files in the Nix store, across all store objects.

Implements nix::Store.

◆ getFSAccessor() [2/2]

std::shared_ptr< SourceAccessor > nix::LegacySSHStore::getFSAccessor ( const StorePath & path,
bool requireValidPath )
inlineoverridevirtual
Returns
An object to access files for a specific store object in the Nix store.
nullptr if the store doesn't contain an object at the given path.

Implements nix::Store.

◆ getProtocol()

unsigned int nix::LegacySSHStore::getProtocol ( )
overridevirtual

Get the protocol version of this store or it's connection.

Reimplemented from nix::Store.

◆ isTrustedClient()

std::optional< TrustedFlag > nix::LegacySSHStore::isTrustedClient ( )
overridevirtual

The legacy ssh protocol doesn't support checking for trusted-user. Try using ssh-ng:// instead if you want to know.

Implements nix::Store.

◆ narFromPath() [1/2]

void nix::LegacySSHStore::narFromPath ( const StorePath & path,
fun< void(Source &)> receiveNar )

Hands over the connection temporarily as source to the given function. The function must not consume beyond the NAR; it can not just blindly try to always read more bytes until it is cut-off.

This is exposed for sake of Hydra.

◆ narFromPath() [2/2]

void nix::LegacySSHStore::narFromPath ( const StorePath & path,
Sink & sink )
overridevirtual

Write a NAR dump of a store path.

Reimplemented from nix::Store.

◆ queryPathFromHashPart()

std::optional< StorePath > nix::LegacySSHStore::queryPathFromHashPart ( const std::string & hashPart)
inlineoverridevirtual

Query the full store path given the hash part of a valid store path, or empty if the path doesn't exist.

Implements nix::Store.

◆ queryPathInfoUncached()

void nix::LegacySSHStore::queryPathInfoUncached ( const StorePath & path,
Callback< std::shared_ptr< const ValidPathInfo > > callback )
overridevirtualnoexcept

Implements nix::Store.

◆ queryRealisationUncached()

void nix::LegacySSHStore::queryRealisationUncached ( const DrvOutput & ,
Callback< std::shared_ptr< const UnkeyedRealisation > > callback )
inlineoverridevirtualnoexcept

Implements nix::Store.

◆ querySubstitutablePaths()

StorePathSet nix::LegacySSHStore::querySubstitutablePaths ( const StorePathSet & paths)
inlineoverridevirtual

Query which of the given paths have substitutes.

Reimplemented from nix::Store.

◆ queryValidPaths() [1/2]

StorePathSet nix::LegacySSHStore::queryValidPaths ( const StorePathSet & paths,
bool lock,
SubstituteFlag maybeSubstitute = NoSubstitute )

Custom variation that atomically creates temp locks on the remote side.

This exists to prevent a race where the remote host garbage-collects paths that are already there. Optionally, ask the remote host to substitute missing paths.

◆ queryValidPaths() [2/2]

StorePathSet nix::LegacySSHStore::queryValidPaths ( const StorePathSet & paths,
SubstituteFlag maybeSubstitute = NoSubstitute )
overridevirtual

Query which of the given paths is valid. Optionally, try to substitute missing paths.

Reimplemented from nix::Store.

◆ registerDrvOutputUnchecked()

void nix::LegacySSHStore::registerDrvOutputUnchecked ( const Realisation & output)
inlineoverridevirtual

Add a mapping indicating that deriver!outputName maps to the output path output.

This is redundant for known-input-addressed and fixed-output derivations as this information is already present in the drv file, but necessary for floating-ca derivations and their dependencies as there's no way to retrieve this information otherwise.

The method that does not perform signature checks is internal only, users should explicitly set the checkSigs argument to NoCheckSigs.

Implements nix::Store.


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