![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <remote-store.hh>
Classes | |
| struct | Connection |
| struct | ConnectionHandle |
Public Types | |
| using | Config = RemoteStoreConfig |
| Public Types inherited from nix::Store | |
| using | Config = StoreConfig |
| using | PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>> |
Public Member Functions | |
| 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) |
| virtual std::optional< std::string > | getBuildLogExact (const StorePath &path)=0 |
Public Attributes | |
| const Config & | config |
| Public Attributes inherited from nix::Store | |
| const Config & | config |
| Public Attributes inherited from nix::StoreDirConfig | |
| const std::string & | storeDir |
Protected Member Functions | |
| virtual ref< Connection > | openConnection ()=0 |
| void | initConnection (Connection &conn) |
| virtual void | setOptions (Connection &conn) |
| void | setOptions () override |
| ConnectionHandle | getConnection () |
| virtual ref< SourceAccessor > | getFSAccessor (bool requireValidPath=true) override |
| virtual std::shared_ptr< SourceAccessor > | getFSAccessor (const StorePath &path, bool requireValidPath=true) override |
| virtual void | narFromPath (const StorePath &path, Sink &sink) override |
| 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 | |
| ref< Pool< Connection > > | connections |
| Protected Attributes inherited from nix::Store | |
| std::shared_ptr< SharedSync< LRUCache< StorePath, PathInfoCacheValue > > > | pathInfoCache |
| std::shared_ptr< NarInfoDiskCache > | diskCache |
Friends | |
| struct | ConnectionHandle |
| struct | RemoteBuilder |
Additional Inherited Members | |
| Static Public Member Functions inherited from nix::SubmitStore | |
| static SubmitStore & | require (Store &store) |
| 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" |
|
overridevirtual |
Implements nix::LogStore.
|
overridevirtual |
Import multiple paths into the store.
Reimplemented from nix::Store.
|
overridevirtual |
Add signatures to the specified store path. The signatures are not verified.
Reimplemented from nix::Store.
|
overridevirtual |
Add a store path as a temporary root of the garbage collector. The root disappears as soon as we exit. Before exiting, if you want to avoid the path being GC'ed, you either have to make it a permanent root using LocalFSStore::addPermRoot(), or make sure it's reachable from a permanent root (e.g. by adding it as a reference of a reachable path).
To avoid races, you should call either this function or LocalFSStore::addPermRoot() before creating and using a store path, e.g.
By contrast, registering a root just before using a path is not sufficient to prevent GC races. For instance, don't do this:
since the path may be GC'ed just before the call to addTempRoot().
Note that addToStore() implicitly calls addTempRoot(), so you don't need to call it yourself if you're calling addToStore() unconditionally.
It is generally the responsibility of the caller of Nix APIs and CLI tools to ensure that paths are reachable by the garbage collector. For example, buildPath(drvPath) does not need to register drvPath as a GC root, since that's the responsibility of the caller, and it would be too late for buildPath() to do so anyway. Thus, this can race:
whereas this is safe:
Reimplemented from nix::Store.
|
overridevirtual |
Add multiple store paths as temporary roots of the garbage collector. The roots disappears as soon as we exit.
Reimplemented from nix::Store.
|
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.
|
overridevirtual |
Add a content-addressable store path. dump will be drained.
Implements nix::Store.
|
overridevirtual |
Add to store, scanning references. Only within a recursive-nix derivation, as there would otherwise be no known set of valid store paths
Implements nix::SubmitStore.
|
overridevirtual |
Perform a garbage collection.
Implements nix::GcStore.
|
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.
|
inlineoverridevirtual |
Delete build trace entries (realisations) from the store's database.
The entries are specified by their key (the build trace is a map).
Implements nix::GcStore.
|
overridevirtual |
Find the roots of the garbage collector. Each root is a pair (link, storepath) where link is the path of the symlink outside of the Nix store that point to storePath. If censor is true, privacy-sensitive information about roots found in /proc is censored.
Implements nix::GcStore.
Get a Builder for this store.
| evalStore | If provided and different from this store, derivation files will be copied from the eval store to this store before building. |
Reimplemented from nix::Store.
|
overrideprotectedvirtual |
Implements nix::Store.
Reimplemented in nix::MountedSSHStore, and nix::UDSRemoteStore.
|
overrideprotectedvirtual |
Implements nix::Store.
Reimplemented in nix::MountedSSHStore, and nix::UDSRemoteStore.
|
overridevirtual |
Get the protocol version of this store or it's connection.
Reimplemented from nix::Store.
|
overridevirtual |
Reimplemented from nix::Store.
|
overridevirtual |
std::nullopt means we do not know.
Implements nix::Store.
|
overridevirtual |
Reimplemented from nix::Store.
Write a NAR dump of a store path.
Reimplemented from nix::Store.
Reimplemented in nix::MountedSSHStore, and nix::UDSRemoteStore.
|
overridevirtual |
Optimise the disk space usage of the Nix store by hard-linking files with the same contents.
Reimplemented from nix::Store.
|
overridevirtual |
Query the set of all valid paths. Note that for some store backends, the name part of store paths may be replaced by x (i.e. you'll get /nix/store/<hash>-x rather than /nix/store/<hash>-<name>). Use queryPathInfo() to obtain the full store path. FIXME: should return a set of std::variant<StorePath, HashPart> to get rid of this hack.
Reimplemented from nix::Store.
|
overridevirtual |
Query the outputs of the derivation denoted by path.
Reimplemented from nix::Store.
|
overridevirtual |
Given a set of paths that are to be built, return the set of derivations that will be built, and the set of output paths that will be substituted.
Reimplemented from nix::Store.
|
overridevirtual |
Query the mapping outputName => outputPath for the given derivation. All outputs are mentioned so ones missing the mapping are mapped to std::nullopt.
Reimplemented from nix::Store.
|
overridevirtual |
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.
|
overridevirtualnoexcept |
Implements nix::Store.
|
overridevirtualnoexcept |
Implements nix::Store.
|
overridevirtual |
Queries the set of incoming FS references for a store path. The result is not cleared.
Reimplemented from nix::Store.
|
overridevirtual |
Query substitute info (i.e. references, derivers and download sizes) of a map of paths to their optional ca values. The info of the first succeeding substituter for each path will be returned. If a path does not have substitute info, it's omitted from the resulting ‘infos’ map.
Reimplemented from nix::Store.
|
overridevirtual |
Query which of the given paths have substitutes.
Reimplemented from nix::Store.
|
overridevirtual |
(Note that the result of queryDeriver() is the derivation that was actually used to produce path, which may not exist anymore.)
Reimplemented from nix::Store.
|
overridevirtual |
Query which of the given paths is valid. Optionally, try to substitute missing paths.
Reimplemented from nix::Store.
|
overridevirtual |
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.
|
overrideprotectedvirtual |
Synchronises the options of the client with those of the daemon (a no-op when there’s no daemon)
Reimplemented from nix::Store.
| void nix::RemoteStore::shutdownConnections | ( | ) |
Shutdown all connections (both idle and in-use) to break any blocking I/O. This is called on interrupt to allow graceful termination when the client disconnects during a long-running operation.
|
overridevirtual |
Submit an output for the current derivation. Only makes sense when running within a recursive-nix derivation
Implements nix::SubmitStore.
|
overridevirtual |