Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::GcStore Struct Referenceabstract

#include <gc-store.hh>

Inheritance diagram for nix::GcStore:
nix::Store nix::LocalFSStore nix::LocalStore nix::RemoteStore nix::IndirectRootStore nix::SSHStore nix::UDSRemoteStore nix::LocalStore nix::UDSRemoteStore

Public Member Functions

virtual kj::Promise< Result< Roots > > findRoots (bool censor)=0
virtual kj::Promise< Result< void > > collectGarbage (const GCOptions &options, GCResults &results)=0
Public Member Functions inherited from nix::Store
virtual std::optional< AssociatedCredentialsassociatedCredentials () const
virtual kj::Promise< Result< void > > init ()
virtual StoreConfigconfig ()=0
virtual const StoreConfigconfig () const =0
virtual std::string getUri ()=0
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
Path followLinksToStore (std::string_view path) const
StorePath followLinksToStorePath (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 makeTextPath (std::string_view name, const TextInfo &info) const
StorePath makeFixedOutputPathFromCA (std::string_view name, const ContentAddressWithReferences &ca) const
StorePath computeStorePathForPathRecursive (std::string_view name, const PreparedDump &source) const
StorePath computeStorePathForPathFlat (std::string_view name, const Path &srcPath) const
StorePath computeStorePathForText (std::string_view name, std::string_view s, const StorePathSet &references) const
kj::Promise< Result< bool > > isValidPath (const StorePath &path)
kj::Promise< Result< void > > substitutePaths (const StorePathSet &paths)
virtual kj::Promise< Result< StorePathSet > > queryValidPaths (const StorePathSet &paths, SubstituteFlag maybeSubstitute=NoSubstitute)
virtual kj::Promise< Result< StorePathSet > > queryAllValidPaths ()
kj::Promise< Result< ref< const ValidPathInfo > > > queryPathInfo (const StorePath &path)
kj::Promise< Result< std::shared_ptr< const Realisation > > > queryRealisation (const DrvOutput &)
virtual bool pathInfoIsUntrusted (const ValidPathInfo &)
virtual bool realisationIsUntrusted (const Realisation &)
virtual kj::Promise< Result< void > > queryReferrers (const StorePath &path, StorePathSet &referrers)
virtual kj::Promise< Result< StorePathSet > > queryValidDerivers (const StorePath &path)
virtual kj::Promise< Result< StorePathSet > > queryDerivationOutputs (const StorePath &path)
virtual kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > queryPartialDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr)
virtual kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > queryStaticPartialDerivationOutputMap (const StorePath &path)
kj::Promise< Result< OutputPathMap > > queryDerivationOutputMap (const StorePath &path, Store *evalStore=nullptr)
virtual kj::Promise< Result< std::optional< StorePath > > > queryPathFromHashPart (const std::string &hashPart)=0
virtual kj::Promise< Result< StorePathSet > > querySubstitutablePaths (const StorePathSet &paths)
virtual kj::Promise< Result< void > > querySubstitutablePathInfos (const StorePathCAMap &paths, SubstitutablePathInfos &infos)
virtual kj::Promise< Result< void > > addToStore (const ValidPathInfo &info, AsyncInputStream &narSource, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)=0
virtual kj::Promise< Result< void > > addMultipleToStore (PathsSource &pathsToCopy, Activity &act, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)
virtual kj::Promise< Result< StorePath > > addToStoreRecursive (std::string_view name, const PreparedDump &source, HashType hashAlgo=HashType::SHA256, RepairFlag repair=NoRepair)
virtual kj::Promise< Result< StorePath > > addToStoreFlat (std::string_view name, const Path &srcPath, HashType hashAlgo=HashType::SHA256, RepairFlag repair=NoRepair)
kj::Promise< Result< ValidPathInfo > > addToStoreSlow (std::string_view name, const Path &srcPath, FileIngestionMethod method=FileIngestionMethod::Recursive, HashType hashAlgo=HashType::SHA256, std::optional< Hash > expectedCAHash={})
virtual kj::Promise< Result< StorePath > > addToStoreFromDump (AsyncInputStream &dump, std::string_view name, FileIngestionMethod method=FileIngestionMethod::Recursive, HashType hashAlgo=HashType::SHA256, RepairFlag repair=NoRepair, const StorePathSet &references=StorePathSet())
virtual kj::Promise< Result< StorePath > > addTextToStore (std::string_view name, std::string_view s, const StorePathSet &references, RepairFlag repair=NoRepair)=0
virtual kj::Promise< Result< void > > registerDrvOutput (const Realisation &output)
virtual kj::Promise< Result< void > > registerDrvOutput (const Realisation &output, CheckSigsFlag checkSigs)
virtual kj::Promise< Result< box_ptr< Source > > > narFromPath (const StorePath &path)=0
virtual kj::Promise< Result< void > > buildPaths (const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr)
virtual kj::Promise< Result< std::vector< KeyedBuildResult > > > buildPathsWithResults (const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr)
virtual kj::Promise< Result< BuildResult > > buildDerivation (const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode=bmNormal)
virtual kj::Promise< Result< void > > ensurePath (const StorePath &path)
virtual kj::Promise< Result< void > > addTempRoot (const StorePath &path)
kj::Promise< Result< std::string > > makeValidityRegistration (const StorePathSet &paths, bool showDerivers, bool showHash)
kj::Promise< Result< JSON > > pathInfoToJSON (const StorePathSet &storePaths, bool includeImpureInfo, bool showClosureSize, Base hashBase=Base::Base32, AllowInvalidFlag allowInvalid=DisallowInvalid)
kj::Promise< Result< std::pair< uint64_t, uint64_t > > > getClosureSize (const StorePath &storePath)
virtual kj::Promise< Result< void > > optimiseStore ()
virtual kj::Promise< Result< bool > > verifyStore (bool checkContents, RepairFlag repair=NoRepair)
virtual ref< FSAccessorgetFSAccessor ()=0
virtual kj::Promise< Result< void > > repairPath (const StorePath &path)
virtual kj::Promise< Result< void > > addSignatures (const StorePath &storePath, const StringSet &sigs)
kj::Promise< Result< Derivation > > derivationFromPath (const StorePath &drvPath)
kj::Promise< Result< Derivation > > readDerivation (const StorePath &drvPath)
kj::Promise< Result< Derivation > > readInvalidDerivation (const StorePath &drvPath)
virtual kj::Promise< Result< void > > computeFSClosure (const StorePathSet &paths, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
kj::Promise< Result< void > > computeFSClosure (const StorePath &path, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
virtual kj::Promise< Result< void > > queryMissing (const std::vector< DerivedPath > &targets, StorePathSet &willBuild, StorePathSet &willSubstitute, StorePathSet &unknown, uint64_t &downloadSize, uint64_t &narSize)
kj::Promise< Result< StorePaths > > topoSortPaths (const StorePathSet &paths)
kj::Promise< Result< void > > exportPaths (const StorePathSet &paths, Sink &sink)
kj::Promise< Result< void > > exportPath (const StorePath &path, Sink &sink)
kj::Promise< Result< StorePaths > > importPaths (Source &source, CheckSigsFlag checkSigs=CheckSigs)
kj::Promise< Result< Stats<> > > getStats ()
kj::Promise< Result< StorePathSet > > exportReferences (const StorePathSet &storePaths, const StorePathSet &inputPaths)
kj::Promise< Result< std::optional< StorePath > > > getBuildDerivationPath (const StorePath &)
kj::Promise< void > clearPathInfoCache ()
virtual kj::Promise< Result< void > > connect ()
virtual kj::Promise< Result< unsigned int > > getProtocol ()
virtual kj::Promise< Result< std::optional< TrustedFlag > > > isTrustedClient ()=0
virtual Path toRealPath (const Path &storePath)
Path toRealPath (const StorePath &storePath)
virtual kj::Promise< Result< void > > setOptions ()
virtual kj::Promise< Result< std::optional< std::string > > > getVersion ()

Static Public Attributes

static std::string operationName = "Garbage collection"
Static Public Attributes inherited from nix::Store
static constexpr const char * MissingName = "x"

Additional Inherited Members

Public Types inherited from nix::Store
using PathsSource
Protected Member Functions inherited from nix::Store
 Store (const StoreConfig &config)
virtual kj::Promise< Result< bool > > isValidPathUncached (const StorePath &path)
virtual kj::Promise< Result< std::shared_ptr< const ValidPathInfo > > > queryPathInfoUncached (const StorePath &path)=0
virtual kj::Promise< Result< std::shared_ptr< const Realisation > > > queryRealisationUncached (const DrvOutput &)=0
void unsupported (const std::string &op)
Protected Attributes inherited from nix::Store
Sync< State, AsyncMutex > state
std::shared_ptr< NarInfoDiskCachediskCache
Stats< std::atomic > stats

Detailed Description

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.

  • The base 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.
Todo
actually this is not so good because stores are views. Some views have only a no-op temp roots even though others to the same store allow triggering GC. For instance one can't add a root over ssh, but that doesn't prevent someone from gc-ing that store accesed via SSH locally).
  • The derived 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.

Member Function Documentation

◆ collectGarbage()

virtual kj::Promise< Result< void > > nix::GcStore::collectGarbage ( const GCOptions & options,
GCResults & results )
pure virtual

Perform a garbage collection.

Implemented in nix::LocalStore, and nix::RemoteStore.

◆ findRoots()

virtual kj::Promise< Result< Roots > > nix::GcStore::findRoots ( bool censor)
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.


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