Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::MountedSSHStore Struct Reference
Inheritance diagram for nix::MountedSSHStore:
nix::SSHStore nix::LocalFSStore nix::RemoteStore nix::Store nix::GcStore nix::LogStore nix::Store nix::Store nix::StoreDirConfig nix::SubmitStore nix::LogStore nix::GcStore nix::Store

Public Types

using Config = MountedSSHStoreConfig
Public Types inherited from nix::SSHStore
using Config = SSHStoreConfig
Public Types inherited from nix::RemoteStore
using Config = RemoteStoreConfig
Public Types inherited from nix::Store
using Config = StoreConfig
using PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>>
Public Types inherited from nix::LocalFSStore
using Config = LocalFSStoreConfig

Public Member Functions

 MountedSSHStore (ref< const Config > config)
void narFromPath (const StorePath &path, Sink &sink) override
ref< SourceAccessor > getFSAccessor (bool requireValidPath) override
std::shared_ptr< SourceAccessor > getFSAccessor (const StorePath &path, bool requireValidPath) override
std::optional< std::string > getBuildLogExact (const StorePath &path) override
std::filesystem::path addPermRoot (const StorePath &path, const std::filesystem::path &gcRoot) override
Public Member Functions inherited from nix::SSHStore
 SSHStore (ref< const Config > config)
std::optional< std::string > getBuildLogExact (const StorePath &path) override
Public Member Functions inherited from nix::RemoteStore
 RemoteStore (const Config &config)
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< StorePath > queryPathFromHashPart (const std::string &hashPart) override
StorePathSet querySubstitutablePaths (const StorePathSet &paths) override
void querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos) 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 addToStore (const ValidPathInfo &info, Source &nar, RepairFlag repair, CheckSigsFlag checkSigs) override
void addMultipleToStore (PathsSource &&pathsToCopy, Activity &act, RepairFlag repair, CheckSigsFlag checkSigs) override
void registerDrvOutputUnchecked (const Realisation &info) override
void submitOutput (const SingleDerivedPath &path, const OutputName &output) override
ref< const ValidPathInfo > addToStoreScanning (Source &dump, std::string_view name, FileSerialisationMethod dumpMethod, ContentAddressMethod hashMethod, HashAlgorithm hashAlgo) override
void queryRealisationUncached (const DrvOutput &, Callback< std::shared_ptr< const UnkeyedRealisation > > callback) noexcept override
ref< Builder > getBuilder (std::shared_ptr< Store > evalStore) override
void addTempRoots (const StorePathSet &paths) override
void addTempRoot (const StorePath &path) override
Roots findRoots (bool censor) override
void collectGarbage (const GCOptions &options, GCResults &results) override
void deleteBuildTraces (const std::set< DrvOutput > &keys) override
void optimiseStore () override
bool verifyStore (bool checkContents, RepairFlag repair) override
void addSignatures (const StorePath &storePath, const std::set< Signature > &sigs) override
MissingPaths queryMissing (const std::vector< DerivedPath > &targets) 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 ()
void shutdownConnections ()
ref< Connection > openConnectionWrapper ()
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)
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 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 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)
ref< SourceAccessor > requireStoreObjectAccessor (const StorePath &path, bool requireValidPath=true)
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)
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)
virtual StorePaths topoSortPaths (const StorePathSet &paths)
StorePathSet exportReferences (const StorePathSet &storePaths, const StorePathSet &inputPaths)
std::optional< StorePath > getBuildDerivationPath (const StorePath &)
void clearPathInfoCache ()
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 Member Functions inherited from nix::LogStore
std::optional< std::string > getBuildLog (const StorePath &path)
Public Member Functions inherited from nix::LocalFSStore
 LocalFSStore (const Config &params)
virtual std::filesystem::path getRealStoreDir ()
std::filesystem::path toRealPath (const StorePath &storePath)

Additional Inherited Members

Static Public Member Functions inherited from nix::SubmitStore
static SubmitStore & require (Store &store)
Public Attributes inherited from nix::SSHStore
ref< const Config > config
Public Attributes inherited from nix::RemoteStore
const Config & config
Public Attributes inherited from nix::Store
const Config & config
Public Attributes inherited from nix::StoreDirConfig
const std::string & storeDir
Public Attributes inherited from nix::LocalFSStore
const Config & config
Static Public Attributes inherited from nix::Store
static constexpr const char * MissingName = "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::SubmitStore
static std::string operationName = "Submit outputs for a currently running derivation"
Static Public Attributes inherited from nix::LocalFSStore
static std::string operationName = "Local Filesystem Store"
static const std::filesystem::path drvsLogDir = "drvs"
Protected Member Functions inherited from nix::SSHStore
ref< RemoteStore::Connection > openConnection () 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
void invalidatePathInfoCacheFor (const StorePath &path)
 Store (const Store::Config &config)
void unsupported (const std::string &op)
Protected Attributes inherited from nix::SSHStore
std::vector< std::string > extraRemoteProgramArgs
SSHMaster master
Protected Attributes inherited from nix::RemoteStore
ref< Pool< Connection > > connections
Protected Attributes inherited from nix::Store
std::shared_ptr< SharedSync< LRUCache< StorePath, PathInfoCacheValue > > > pathInfoCache
std::shared_ptr< NarInfoDiskCache > diskCache

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 difference 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()

std::filesystem::path nix::MountedSSHStore::addPermRoot ( const StorePath & path,
const std::filesystem::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() [1/2]

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

Reimplemented from nix::RemoteStore.

◆ getFSAccessor() [2/2]

std::shared_ptr< SourceAccessor > nix::MountedSSHStore::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.

Reimplemented from nix::RemoteStore.

◆ 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 struct was generated from the following file:
  • libstore/ssh-store.cc