#include <gc-store.hh>
Public Member Functions | |
virtual Roots | findRoots (bool censor)=0 |
virtual void | collectGarbage (const GCOptions &options, GCResults &results)=0 |
![]() | |
virtual void | init () |
virtual std::string | getUri ()=0 |
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 | queryValidPaths (const StorePathSet &paths, SubstituteFlag maybeSubstitute=NoSubstitute) |
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 Realisation > | queryRealisation (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 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) |
OutputPathMap | queryDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr) |
virtual std::optional< StorePath > | queryPathFromHashPart (const std::string &hashPart)=0 |
virtual StorePathSet | querySubstitutablePaths (const StorePathSet &paths) |
virtual void | querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos) |
virtual void | addToStore (const ValidPathInfo &info, Source &narSource, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)=0 |
virtual void | addMultipleToStore (Source &source, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs) |
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 StorePath | addToStoreFromDump (Source &dump, std::string_view name, FileSerialisationMethod dumpMethod=FileSerialisationMethod::NixArchive, ContentAddressMethod hashMethod=ContentAddressMethod::Raw::NixArchive, HashAlgorithm hashAlgo=HashAlgorithm::SHA256, const StorePathSet &references=StorePathSet(), RepairFlag repair=NoRepair)=0 |
virtual void | registerDrvOutput (const Realisation &output) |
virtual void | registerDrvOutput (const Realisation &output, CheckSigsFlag checkSigs) |
virtual void | narFromPath (const StorePath &path, Sink &sink)=0 |
virtual void | buildPaths (const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr) |
virtual std::vector< KeyedBuildResult > | buildPathsWithResults (const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr) |
virtual BuildResult | buildDerivation (const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode=bmNormal) |
virtual void | ensurePath (const StorePath &path) |
virtual void | addTempRoot (const StorePath &path) |
std::string | makeValidityRegistration (const StorePathSet &paths, bool showDerivers, bool showHash) |
virtual void | optimiseStore () |
virtual bool | verifyStore (bool checkContents, RepairFlag repair=NoRepair) |
virtual ref< SourceAccessor > | getFSAccessor (bool requireValidPath=true)=0 |
virtual void | repairPath (const StorePath &path) |
virtual void | addSignatures (const StorePath &storePath, const StringSet &sigs) |
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) |
virtual void | queryMissing (const std::vector< DerivedPath > &targets, StorePathSet &willBuild, StorePathSet &willSubstitute, StorePathSet &unknown, uint64_t &downloadSize, uint64_t &narSize) |
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 Stats & | getStats () |
StorePathSet | exportReferences (const StorePathSet &storePaths, const StorePathSet &inputPaths) |
std::optional< StorePath > | getBuildDerivationPath (const StorePath &) |
void | clearPathInfoCache () |
virtual void | connect () |
virtual unsigned int | getProtocol () |
virtual std::optional< TrustedFlag > | isTrustedClient ()=0 |
virtual Path | toRealPath (const Path &storePath) |
Path | toRealPath (const StorePath &storePath) |
virtual void | setOptions () |
virtual std::optional< std::string > | getVersion () |
![]() | |
virtual const std::string | name ()=0 |
virtual std::string | doc () |
virtual std::optional< ExperimentalFeature > | experimentalFeature () const |
StoreDirConfig ()=delete | |
![]() | |
StorePath | parseStorePath (std::string_view path) const |
std::optional< StorePath > | maybeParseStorePath (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, Path > | toStorePath (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, Hash > | computeStorePath (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={}) | |
![]() | |
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 |
![]() | |
void | applyConfig (const std::string &contents, const std::string &path="<unknown>") |
void | warnUnknownSettings () |
void | reapplyUnknownSettings () |
Static Public Attributes | |
static std::string | operationName = "Garbage collection" |
![]() | |
static constexpr const char * | MissingName = "x" |
Additional Inherited Members | |
![]() | |
using | PathsSource = std::vector<std::pair<ValidPathInfo, std::unique_ptr<Source>>> |
![]() | |
using | Params = StoreReference::Params |
![]() | |
using | Settings = std::map<std::string, SettingData> |
![]() | |
static StringSet | getDefaultSystemFeatures () |
![]() | |
const Setting< int > | pathInfoCacheSize |
const Setting< bool > | isTrusted |
Setting< int > | priority |
Setting< bool > | wantMassQuery |
Setting< StringSet > | systemFeatures |
![]() | |
const PathSetting | storeDir_ |
const Path | storeDir = storeDir_ |
![]() | |
Store (const Params ¶ms) | |
virtual bool | isValidPathUncached (const StorePath &path) |
virtual void | queryPathInfoUncached (const StorePath &path, Callback< std::shared_ptr< const ValidPathInfo > > callback) noexcept=0 |
virtual void | queryRealisationUncached (const DrvOutput &, Callback< std::shared_ptr< const Realisation > > callback) noexcept=0 |
void | unsupported (const std::string &op) |
![]() | |
AbstractConfig (StringMap initials={}) | |
![]() | |
SharedSync< State > | state |
std::shared_ptr< NarInfoDiskCache > | diskCache |
Stats | stats |
![]() | |
StringMap | unknownSettings |
Mix-in class for stores which expose a notion of garbage collection.
Garbage collection will allow deleting paths which are not transitively "rooted".
The notion of GC roots actually not part of this class.
Store
class has Store::addTempRoot()
because for a store that doesn't support garbage collection at all, a temporary GC root is safely implementable as no-op.LocalFSStore
class has LocalFSStore::addPermRoot
, which is not part of this class because it relies on the notion of an ambient file system. There are stores (ssh-ng://
, for one), that do support garbage collection but don't expose any file system, and LocalFSStore::addPermRoot
thus does not make sense for them.
|
pure virtual |
Perform a garbage collection.
Implemented in nix::LocalStore, and nix::RemoteStore.
|
pure virtual |
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.
Implemented in nix::LocalStore, and nix::RemoteStore.