Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nix::MountedSSHStore Class Reference
Inheritance diagram for nix::MountedSSHStore:
nix::MountedSSHStoreConfig nix::SSHStore nix::LocalFSStore nix::LogStore nix::GcStore nix::Store nix::LocalFSStoreConfig nix::RemoteStore nix::SSHStoreConfig nix::LocalFSStoreConfig nix::SSHStoreConfig

Public Member Functions

 MountedSSHStore (std::string_view scheme, std::string_view host, const Params &params)
 
std::string getUri () override
 
void narFromPath (const StorePath &path, Sink &sink) override
 
ref< SourceAccessorgetFSAccessor (bool requireValidPath) override
 
std::optional< std::string > getBuildLogExact (const StorePath &path) override
 
Path addPermRoot (const StorePath &path, const Path &gcRoot) override
 
- Public Member Functions inherited from nix::MountedSSHStoreConfig
 MountedSSHStoreConfig (StringMap params)
 
 MountedSSHStoreConfig (std::string_view scheme, std::string_view host, StringMap params)
 
const std::string name () override
 
std::string doc () override
 
std::optional< ExperimentalFeatureexperimentalFeature () const override
 
 LocalFSStoreConfig (PathView path, const Params &params)
 
 SSHStoreConfig (std::string_view scheme, std::string_view authority, const Params &params)
 
- Public Member Functions inherited from nix::SSHStoreConfig
 SSHStoreConfig (std::string_view scheme, std::string_view authority, const Params &params)
 
const std::string name () override
 
std::string doc () override
 
 CommonSSHStoreConfig (std::string_view scheme, std::string_view host, const Params &params)
 
- Public Member Functions inherited from nix::RemoteStoreConfig
 StoreConfig ()=delete
 
- Public Member Functions inherited from nix::StoreConfig
 StoreDirConfig ()=delete
 
- Public Member Functions inherited from nix::StoreDirConfig
StorePath parseStorePath (std::string_view path) const
 
std::optional< StorePathmaybeParseStorePath (std::string_view path) const
 
std::string printStorePath (const StorePath &path) const
 
StorePathSet parseStorePathSet (const PathSet &paths) const
 
PathSet printStorePathSet (const StorePathSet &path) const
 
std::string showPaths (const StorePathSet &paths)
 
bool isInStore (PathView path) const
 
bool isStorePath (std::string_view path) const
 
std::pair< StorePath, PathtoStorePath (PathView 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, HashcomputeStorePath (std::string_view name, const SourcePath &path, ContentAddressMethod method=FileIngestionMethod::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references={}, PathFilter &filter=defaultPathFilter) const
 
 Config (StringMap initials={})
 
- Public Member Functions inherited from nix::Config
 Config (StringMap initials={})
 
bool set (const std::string &name, const std::string &value) override
 
void addSetting (AbstractSetting *setting)
 
void getSettings (std::map< std::string, SettingInfo > &res, bool overriddenOnly=false) override
 
void resetOverridden () override
 
nlohmann::json toJSON () override
 
std::string toKeyValue () override
 
void convertToArgs (Args &args, const std::string &category) override
 
- Public Member Functions inherited from nix::AbstractConfig
void applyConfig (const std::string &contents, const std::string &path="<unknown>")
 
void warnUnknownSettings ()
 
void reapplyUnknownSettings ()
 
- Public Member Functions inherited from nix::CommonSSHStoreConfig
 CommonSSHStoreConfig (std::string_view scheme, std::string_view host, const Params &params)
 
SSHMaster createSSHMaster (bool useMaster, Descriptor logFD=INVALID_DESCRIPTOR)
 
 StoreConfig ()=delete
 
- Public Member Functions inherited from nix::LocalFSStoreConfig
 LocalFSStoreConfig (PathView path, const Params &params)
 
 StoreConfig ()=delete
 
- Public Member Functions inherited from nix::SSHStore
 SSHStore (std::string_view scheme, std::string_view host, const Params &params)
 
std::string getUri () override
 
std::optional< std::string > getBuildLogExact (const StorePath &path) override
 
- Public Member Functions inherited from nix::RemoteStore
 RemoteStore (const Params &params)
 
bool isValidPathUncached (const StorePath &path) override
 
StorePathSet queryValidPaths (const StorePathSet &paths, SubstituteFlag maybeSubstitute=NoSubstitute) override
 
StorePathSet queryAllValidPaths () override
 
void queryPathInfoUncached (const StorePath &path, Callback< std::shared_ptr< const ValidPathInfo > > callback) noexcept override
 
void queryReferrers (const StorePath &path, StorePathSet &referrers) override
 
StorePathSet queryValidDerivers (const StorePath &path) override
 
StorePathSet queryDerivationOutputs (const StorePath &path) override
 
std::map< std::string, std::optional< StorePath > > queryPartialDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr) override
 
std::optional< StorePathqueryPathFromHashPart (const std::string &hashPart) override
 
StorePathSet querySubstitutablePaths (const StorePathSet &paths) override
 
void querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos) override
 
ref< const ValidPathInfoaddCAToStore (Source &dump, std::string_view name, ContentAddressMethod caMethod, HashAlgorithm hashAlgo, const StorePathSet &references, RepairFlag repair)
 
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 addToStore (const ValidPathInfo &info, Source &nar, RepairFlag repair, CheckSigsFlag checkSigs) override
 
void addMultipleToStore (Source &source, RepairFlag repair, CheckSigsFlag checkSigs) override
 
void addMultipleToStore (PathsSource &&pathsToCopy, Activity &act, RepairFlag repair, CheckSigsFlag checkSigs) override
 
void registerDrvOutput (const Realisation &info) override
 
void queryRealisationUncached (const DrvOutput &, Callback< std::shared_ptr< const Realisation > > callback) noexcept override
 
void buildPaths (const std::vector< DerivedPath > &paths, BuildMode buildMode, std::shared_ptr< Store > evalStore) override
 
std::vector< KeyedBuildResultbuildPathsWithResults (const std::vector< DerivedPath > &paths, BuildMode buildMode, std::shared_ptr< Store > evalStore) override
 
BuildResult buildDerivation (const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode) override
 
void ensurePath (const StorePath &path) override
 
void addTempRoot (const StorePath &path) override
 
Roots findRoots (bool censor) override
 
void collectGarbage (const GCOptions &options, GCResults &results) override
 
void optimiseStore () override
 
bool verifyStore (bool checkContents, RepairFlag repair) override
 
void repairPath (const StorePath &path) override
 
void addSignatures (const StorePath &storePath, const StringSet &sigs) override
 
void queryMissing (const std::vector< DerivedPath > &targets, StorePathSet &willBuild, StorePathSet &willSubstitute, StorePathSet &unknown, uint64_t &downloadSize, uint64_t &narSize) override
 
void addBuildLog (const StorePath &drvPath, std::string_view log) override
 
std::optional< std::string > getVersion () override
 
void connect () override
 
unsigned int getProtocol () override
 
std::optional< TrustedFlag > isTrustedClient () override
 
void flushBadConnections ()
 
ref< ConnectionopenConnectionWrapper ()
 
- Public Member Functions inherited from nix::Store
virtual void init ()
 
Path followLinksToStore (std::string_view path) const
 
StorePath followLinksToStorePath (std::string_view path) const
 
bool isValidPath (const StorePath &path)
 
void substitutePaths (const StorePathSet &paths)
 
ref< const ValidPathInfoqueryPathInfo (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 RealisationqueryRealisation (const DrvOutput &)
 
void queryRealisation (const DrvOutput &, Callback< std::shared_ptr< const Realisation > > callback) noexcept
 
virtual bool pathInfoIsUntrusted (const ValidPathInfo &)
 
virtual bool realisationIsUntrusted (const Realisation &)
 
virtual std::map< std::string, std::optional< StorePath > > queryStaticPartialDerivationOutputMap (const StorePath &path)
 
OutputPathMap queryDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr)
 
virtual StorePath addToStore (std::string_view name, const SourcePath &path, ContentAddressMethod method=ContentAddressMethod::Raw::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references=StorePathSet(), PathFilter &filter=defaultPathFilter, RepairFlag repair=NoRepair)
 
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)
 
std::string makeValidityRegistration (const StorePathSet &paths, bool showDerivers, bool showHash)
 
Derivation derivationFromPath (const StorePath &drvPath)
 
Derivation readDerivation (const StorePath &drvPath)
 
Derivation readInvalidDerivation (const StorePath &drvPath)
 
virtual void computeFSClosure (const StorePathSet &paths, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
 
void computeFSClosure (const StorePath &path, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
 
StorePaths topoSortPaths (const StorePathSet &paths)
 
void exportPaths (const StorePathSet &paths, Sink &sink)
 
void exportPath (const StorePath &path, Sink &sink)
 
StorePaths importPaths (Source &source, CheckSigsFlag checkSigs=CheckSigs)
 
const StatsgetStats ()
 
StorePathSet exportReferences (const StorePathSet &storePaths, const StorePathSet &inputPaths)
 
std::optional< StorePathgetBuildDerivationPath (const StorePath &)
 
void clearPathInfoCache ()
 
Path toRealPath (const StorePath &storePath)
 
- Public Member Functions inherited from nix::LogStore
std::optional< std::string > getBuildLog (const StorePath &path)
 
- Public Member Functions inherited from nix::LocalFSStore
 LocalFSStore (const Params &params)
 
virtual Path getRealStoreDir ()
 
Path toRealPath (const Path &storePath) override
 

Additional Inherited Members

- Public Types inherited from nix::StoreConfig
using Params = StoreReference::Params
 
- Public Types inherited from nix::Config
using Settings = std::map<std::string, SettingData>
 
- Public Types inherited from nix::Store
using PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>>
 
- Static Public Member Functions inherited from nix::MountedSSHStoreConfig
static std::set< std::string > uriSchemes ()
 
- Static Public Member Functions inherited from nix::SSHStoreConfig
static std::set< std::string > uriSchemes ()
 
- Static Public Member Functions inherited from nix::StoreConfig
static StringSet getDefaultSystemFeatures ()
 
- Static Public Member Functions inherited from nix::LogStore
static LogStorerequire (Store &store)
 
- Public Attributes inherited from nix::SSHStoreConfig
const Setting< Strings > remoteProgram
 
- Public Attributes inherited from nix::RemoteStoreConfig
const Setting< intmaxConnections
 
const Setting< unsigned intmaxConnectionAge
 
- Public Attributes inherited from nix::StoreConfig
const Setting< intpathInfoCacheSize
 
const Setting< bool > isTrusted
 
Setting< intpriority
 
Setting< bool > wantMassQuery
 
Setting< StringSet > systemFeatures
 
- Public Attributes inherited from nix::StoreDirConfig
const PathSetting storeDir_
 
const Path storeDir = storeDir_
 
- Public Attributes inherited from nix::CommonSSHStoreConfig
const Setting< PathsshKey
 
const Setting< std::string > sshPublicHostKey
 
const Setting< bool > compress
 
const Setting< std::string > remoteStore
 
std::string host
 
- Public Attributes inherited from nix::LocalFSStoreConfig
const OptionalPathSetting rootDir
 
const PathSetting stateDir
 
const PathSetting logDir
 
const PathSetting realStoreDir
 
- Static Public Attributes inherited from nix::Store
static constexpr const charMissingName = "x"
 
- Static Public Attributes inherited from nix::GcStore
static std::string operationName = "Garbage collection"
 
- Static Public Attributes inherited from nix::LogStore
static std::string operationName = "Build log storage and retrieval"
 
- Static Public Attributes inherited from nix::LocalFSStore
static std::string operationName = "Local Filesystem Store"
 
static const std::string drvsLogDir = "drvs"
 
- Protected Member Functions inherited from nix::AbstractConfig
 AbstractConfig (StringMap initials={})
 
- Protected Member Functions inherited from nix::SSHStore
ref< RemoteStore::ConnectionopenConnection () override
 
void setOptions (RemoteStore::Connection &conn) override
 
- Protected Member Functions inherited from nix::RemoteStore
void initConnection (Connection &conn)
 
void setOptions () override
 
ConnectionHandle getConnection ()
 
- Protected Member Functions inherited from nix::Store
 Store (const Params &params)
 
void unsupported (const std::string &op)
 
- Protected Attributes inherited from nix::AbstractConfig
StringMap unknownSettings
 
- Protected Attributes inherited from nix::SSHStore
std::string host
 
std::vector< std::string > extraRemoteProgramArgs
 
SSHMaster master
 
- Protected Attributes inherited from nix::RemoteStore
ref< Pool< Connection > > connections
 
- Protected Attributes inherited from nix::Store
SharedSync< Statestate
 
std::shared_ptr< NarInfoDiskCachediskCache
 
Stats stats
 

Detailed Description

The mounted ssh store assumes that filesystems on the remote host are shared with the local host. This means that the remote nix store is available locally and is therefore treated as a local filesystem store.

MountedSSHStore is very similar to UDSRemoteStore — ignoring the superficial differnce of SSH vs Unix domain sockets, they both are accessing remote stores, and they both assume the store will be mounted in the local filesystem.

The difference lies in how they manage GC roots. See addPermRoot below for details.

Member Function Documentation

◆ addPermRoot()

Path nix::MountedSSHStore::addPermRoot ( const StorePath & path,
const Path & gcRoot )
inlineoverridevirtual

This is the key difference from UDSRemoteStore: UDSRemote store has the client create the direct root, and the remote side create the indirect root.

We could also do that, but the race conditions (will the remote side see the direct root the client made?) seems bigger.

In addition, the remote-side will have a process associated with the authenticating user handling the connection (even if there is a system-wide daemon or similar). This process can safely make the direct and indirect roots without there being such a risk of privilege escalation / symlinks in directories owned by the originating requester that they cannot delete.

Implements nix::LocalFSStore.

◆ getBuildLogExact()

std::optional< std::string > nix::MountedSSHStore::getBuildLogExact ( const StorePath & path)
inlineoverridevirtual

Implements nix::LogStore.

◆ getFSAccessor()

ref< SourceAccessor > nix::MountedSSHStore::getFSAccessor ( bool requireValidPath)
inlineoverridevirtual
Returns
An object to access files in the Nix store.

Reimplemented from nix::RemoteStore.

◆ getUri()

std::string nix::MountedSSHStore::getUri ( )
inlineoverridevirtual
Todo
move to StoreConfig one we store enough information in those to recover the scheme and authority in all cases.

Implements nix::Store.

◆ narFromPath()

void nix::MountedSSHStore::narFromPath ( const StorePath & path,
Sink & sink )
inlineoverridevirtual

Write a NAR dump of a store path.

Reimplemented from nix::RemoteStore.


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