![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
Classes | |
| struct | VerificationResult |
Public Types | |
| using | Config = LocalStoreConfig |
| Public Types inherited from nix::LocalFSStore | |
| using | Config = LocalFSStoreConfig |
| Public Types inherited from nix::Store | |
| using | Config = StoreConfig |
| using | PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>> |
Public Member Functions | |
| LocalStore (ref< const Config > 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 |
| std::map< std::string, std::optional< StorePath > > | queryStaticPartialDerivationOutputMap (const StorePath &path) override |
| std::optional< StorePath > | queryStaticPartialDerivationOutput (const StorePath &path, const std::string &outputName) override |
| std::optional< StorePath > | queryPathFromHashPart (const std::string &hashPart) override |
| bool | pathInfoIsUntrusted (const ValidPathInfo &) override |
| bool | realisationIsUntrusted (const Realisation &) override |
| void | addToStore (const ValidPathInfo &info, Source &source, RepairFlag repair, CheckSigsFlag checkSigs) override |
| StorePath | addToStoreFromDump (Source &dump, std::string_view name, FileSerialisationMethod dumpMethod, ContentAddressMethod hashMethod, HashAlgorithm hashAlgo, const StorePathSet &references, RepairFlag repair) override |
| StorePath | addToStoreFromDump (Source &dump, std::string_view name, FileSerialisationMethod dumpMethod, ContentAddressMethod hashMethod, HashAlgorithm hashAlgo, const StorePathSet &references, RepairFlag repair, bool filterReferences) |
| void | addTempRoots (const StorePathSet &paths) override |
| void | addIndirectRoot (const std::filesystem::path &path) override |
| Roots | findRoots (bool censor) override |
| void | collectGarbage (const GCOptions &options, GCResults &results) override |
| void | deleteBuildTraces (const std::set< DrvOutput > &keys) override |
| virtual void | queryGCReferrers (const StorePath &path, StorePathSet &referrers) |
| virtual void | deleteStorePath (const std::filesystem::path &path, uint64_t &bytesFreed, bool isKnownPath) |
| void | optimiseStore (OptimiseStats &stats) |
| void | optimiseStore () override |
| void | optimisePath (const std::filesystem::path &path, RepairFlag repair) |
| bool | verifyStore (bool checkContents, RepairFlag repair) override |
| void | registerValidPath (const ValidPathInfo &info) |
| virtual void | registerValidPaths (const ValidPathInfos &infos) |
| unsigned int | getProtocol () override |
| std::optional< TrustedFlag > | isTrustedClient () override |
| void | vacuumDB () |
| void | addSignatures (const StorePath &storePath, const std::set< Signature > &sigs) override |
| void | autoGC (bool sync=true) |
| void | registerDrvOutputUnchecked (const Realisation &info) override |
| void | registerDrvOutput (const Realisation &info, CheckSigsFlag checkSigs) override |
| void | cacheDrvOutputMapping (State &state, const uint64_t deriver, const std::string &outputName, const StorePath &output) |
| std::optional< const UnkeyedRealisation > | queryRealisation_ (State &state, const DrvOutput &id) |
| std::optional< std::pair< int64_t, UnkeyedRealisation > > | queryRealisationCore_ (State &state, const DrvOutput &id) |
| void | queryRealisationUncached (const DrvOutput &, Callback< std::shared_ptr< const UnkeyedRealisation > > callback) noexcept override |
| std::optional< std::string > | getVersion () override |
| Public Member Functions inherited from nix::IndirectRootStore | |
| std::filesystem::path | addPermRoot (const StorePath &storePath, const std::filesystem::path &gcRoot) override final |
| Public Member Functions inherited from nix::LocalFSStore | |
| LocalFSStore (const Config ¶ms) | |
| ref< SourceAccessor > | getFSAccessor (bool requireValidPath=true) override |
| std::shared_ptr< SourceAccessor > | getFSAccessor (const StorePath &path, bool requireValidPath=true) override |
| virtual std::filesystem::path | getRealStoreDir () |
| std::filesystem::path | toRealPath (const StorePath &storePath) |
| std::optional< std::string > | getBuildLogExact (const StorePath &path) override |
| Public Member Functions inherited from nix::Store | |
| operator const Config & () const | |
| virtual void | init () |
| virtual ref< Builder > | getBuilder (std::shared_ptr< Store > evalStore=nullptr) |
| 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 StorePathSet | queryDerivationOutputs (const StorePath &path) |
| virtual std::map< std::string, std::optional< StorePath > > | queryPartialDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr) |
| OutputPathMap | queryDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr) |
| virtual StorePathSet | querySubstitutablePaths (const StorePathSet &paths) |
| virtual void | querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos) |
| virtual void | addMultipleToStore (PathsSource &&pathsToCopy, Activity &act, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs) |
| 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 | narFromPath (const StorePath &path, Sink &sink) |
| virtual void | addTempRoot (const StorePath &path) |
| 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 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 | connect () |
| virtual void | setOptions () |
| 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 Attributes | |
| ref< const LocalStoreConfig > | config |
| const std::filesystem::path | dbDir |
| const std::filesystem::path | linksDir |
| const std::filesystem::path | reservedPath |
| const std::filesystem::path | schemaPath |
| const std::filesystem::path | tempRootsDir |
| const std::filesystem::path | fnTempRoots |
| PathSet | locksHeld |
| Public Attributes inherited from nix::LocalFSStore | |
| 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 VerificationResult | verifyAllValidPaths (RepairFlag repair) |
| void | verifyPath (const StorePath &path, fun< bool(const StorePath &)> existsInStoreDir, StorePathSet &done, StorePathSet &validPaths, RepairFlag repair, bool &errors) |
| Protected Member Functions inherited from nix::IndirectRootStore | |
| void | makeSymlink (const std::filesystem::path &link, const std::filesystem::path &target) |
| Protected Member Functions inherited from nix::Store | |
| void | invalidatePathInfoCacheFor (const StorePath &path) |
| Store (const Store::Config &config) | |
| void | unsupported (const std::string &op) |
Friends | |
| class | PathSubstitutionGoal |
| struct | DerivationGoal |
| class | DerivationBuilderImpl |
Additional Inherited Members | |
| Static Public Attributes inherited from nix::IndirectRootStore | |
| static std::string | operationName = "Indirect GC roots registration" |
| Static Public Attributes inherited from nix::LocalFSStore | |
| static std::string | operationName = "Local Filesystem Store" |
| static const std::filesystem::path | drvsLogDir = "drvs" |
| 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" |
| Protected Attributes inherited from nix::Store | |
| std::shared_ptr< SharedSync< LRUCache< StorePath, PathInfoCacheValue > > > | pathInfoCache |
| std::shared_ptr< NarInfoDiskCache > | diskCache |
| nix::LocalStore::LocalStore | ( | ref< const Config > | params | ) |
Initialise the local store, upgrading the schema if necessary.
|
overridevirtual |
Implementation of IndirectRootStore::addIndirectRoot().
The weak reference merely is a symlink to path' from /nix/var/nix/gcroots/auto/<hash of path'>.
Implements nix::IndirectRootStore.
|
overridevirtual |
Add signatures to the specified store path. The signatures are not verified.
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 |
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.
| dumpMethod | What serialisation format is dump, i.e. how to deserialize it. Must either match hashMethod or be FileSerialisationMethod::NixArchive. |
| hashMethod | How content addressing? Need not match be the same as dumpMethod. |
Implements nix::Store.
| void nix::LocalStore::autoGC | ( | bool | sync = true | ) |
If free disk space in /nix/store if below minFree, delete garbage until it exceeds maxFree.
|
overridevirtual |
Perform a garbage collection.
Implements nix::GcStore.
|
overridevirtual |
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.
|
virtual |
Called by collectGarbage to recursively delete a path. The default implementation simply calls deletePath, but it can be overridden by stores that wish to provide their own deletion behaviour.
| isKnownPath | true if this is a known store path, false if it's garbage/unknown content found in the store directory | |
| [out] | bytesFreed | An estimation of how many bytes of disk space have been reclaimed. It should be considered to be only a rough estimate. Initialised to zero by this function so that the caller may not need to initialise it. |
|
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.
|
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 |
Implementations of abstract store API methods.
Reimplemented from nix::Store.
| void nix::LocalStore::optimisePath | ( | const std::filesystem::path & | path, |
| RepairFlag | repair ) |
Optimise a single store path. Optionally, test the encountered symlinks for corruption.
|
overridevirtual |
Optimise the disk space usage of the Nix store by hard-linking files with the same contents.
Reimplemented from nix::Store.
| void nix::LocalStore::optimiseStore | ( | OptimiseStats & | stats | ) |
Optimise the disk space usage of the Nix store by hard-linking files with the same contents.
|
overridevirtual |
Check whether the given valid path info is sufficiently attested, by either being signed by a trusted public key or content-addressed, in order to be included in the given store.
These same checks would be performed in addToStore, but this allows an earlier failure in the case where dependencies need to be added too, but the addToStore wouldn't fail until those dependencies are added. Also, we don't really want to add the dependencies listed in a nar info we don't trust anyyways.
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.
|
inlinevirtual |
Called by collectGarbage to trace in reverse.
Using this rather than queryReferrers directly allows us to fine-tune which referrers we consider for garbage collection; some store implementations take advantage of this.
|
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 |
Like the above, but for a single output.
Reimplemented from nix::Store.
|
overridevirtual |
Like queryPartialDerivationOutputMap but only considers statically known output paths (i.e. those that can be gotten from the derivation itself.
Just a helper function for implementing queryPartialDerivationOutputMap.
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 |
Reimplemented from nix::Store.
|
overridevirtual |
Reimplemented from nix::Store.
|
overridevirtual |
Register the store path 'output' as the output named 'outputName' of derivation 'deriver'.
Implements nix::Store.
| void nix::LocalStore::registerValidPath | ( | const ValidPathInfo & | info | ) |
Register the validity of a path, i.e., that path exists, that the paths referenced by it exists, and in the case of an output path of a derivation, that it has been produced by a successful execution of the derivation (or something equivalent). Also register the hash of the file system contents of the path. The hash must be a SHA-256 hash.
|
protectedvirtual |
First, unconditional step of verifyStore
|
overridevirtual |
| PathSet nix::LocalStore::locksHeld |
Hack for build-remote.cc.