Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
store-api.hh File Reference
#include "path.hh"
#include "derived-path.hh"
#include "hash.hh"
#include "content-address.hh"
#include "serialise.hh"
#include "lru-cache.hh"
#include "sync.hh"
#include "globals.hh"
#include "config.hh"
#include "path-info.hh"
#include "repair-flag.hh"
#include "store-dir-config.hh"
#include "store-reference.hh"
#include "source-path.hh"
#include <nlohmann/json_fwd.hpp>
#include <atomic>
#include <map>
#include <memory>
#include <string>
#include <chrono>

Go to the source code of this file.

Classes

struct  nix::StoreConfig
 
class  nix::Store
 
struct  nix::Store::PathInfoCacheValue
 
struct  nix::Store::State
 
struct  nix::Store::Stats
 
struct  nix::StoreFactory
 
struct  nix::Implementations
 
struct  nix::RegisterStoreImplementation< T, TConfig >
 

Typedefs

typedef std::map< std::string, StorePathnix::OutputPathMap
 
typedef std::map< StorePath, std::optional< ContentAddress > > nix::StorePathCAMap
 

Enumerations

enum  CheckSigsFlag : bool { NoCheckSigs = false , CheckSigs = true }
 
enum  SubstituteFlag : bool { NoSubstitute = false , Substitute = true }
 
enum  BuildMode : uint8_t { bmNormal , bmRepair , bmCheck }
 
enum  TrustedFlag : bool { NotTrusted = false , Trusted = true }
 

Functions

 nix::MakeError (SubstError, Error)
 
 nix::MakeError (BuildError, Error)
 
 nix::MakeError (InvalidPath, Error)
 
 nix::MakeError (Unsupported, Error)
 
 nix::MakeError (SubstituteGone, Error)
 
 nix::MakeError (SubstituterDisabled, Error)
 
 nix::MakeError (InvalidStoreReference, Error)
 
void nix::copyStorePath (Store &srcStore, Store &dstStore, const StorePath &storePath, RepairFlag repair, CheckSigsFlag checkSigs)
 
std::map< StorePath, StorePathnix::copyPaths (Store &srcStore, Store &dstStore, const std::set< RealisedPath > &, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs, SubstituteFlag substitute=NoSubstitute)
 
std::map< StorePath, StorePathnix::copyPaths (Store &srcStore, Store &dstStore, const StorePathSet &storePaths, RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
 
void nix::copyClosure (Store &srcStore, Store &dstStore, const std::set< RealisedPath > &paths, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs, SubstituteFlag substitute=NoSubstitute)
 
void nix::copyClosure (Store &srcStore, Store &dstStore, const StorePathSet &storePaths, RepairFlag repair, CheckSigsFlag checkSigs, SubstituteFlag substitute)
 
void nix::removeTempRoots ()
 
StorePath nix::resolveDerivedPath (Store &store, const SingleDerivedPath &req, Store *evalStore_)
 
OutputPathMap nix::resolveDerivedPath (Store &store, const DerivedPath::Built &bfd, Store *evalStore_)
 
ref< Storenix::openStore (StoreReference &&storeURI)
 
ref< Storenix::openStore (const std::string &uri, const Store::Params &extraParams)
 
std::list< ref< Store > > nix::getDefaultSubstituters ()
 
std::string nix::showPaths (const PathSet &paths)
 
std::optional< ValidPathInfonix::decodeValidPathInfo (const Store &store, std::istream &str, std::optional< HashResult > hashGiven)
 
const ContentAddressnix::getDerivationCA (const BasicDerivation &drv)
 
std::map< DrvOutput, StorePathnix::drvOutputReferences (Store &store, const Derivation &drv, const StorePath &outputPath, Store *evalStore_)
 

Variables

const uint32_t nix::exportMagic = 0x4558494e
 

Function Documentation

◆ copyClosure()

void nix::copyClosure ( Store & srcStore,
Store & dstStore,
const std::set< RealisedPath > & paths,
RepairFlag repair = NoRepair,
CheckSigsFlag checkSigs = CheckSigs,
SubstituteFlag substitute = NoSubstitute )

Copy the closure of paths from srcStore to dstStore.

◆ copyPaths()

std::map< StorePath, StorePath > nix::copyPaths ( Store & srcStore,
Store & dstStore,
const std::set< RealisedPath > & ,
RepairFlag repair = NoRepair,
CheckSigsFlag checkSigs = CheckSigs,
SubstituteFlag substitute = NoSubstitute )

Copy store paths from one store to another. The paths may be copied in parallel. They are copied in a topologically sorted order (i.e. if A is a reference of B, then A is copied before B), but the set of store paths is not automatically closed; use copyClosure() for that.

Returns
a map of what each path was copied to the dstStore as.

◆ copyStorePath()

void nix::copyStorePath ( Store & srcStore,
Store & dstStore,
const StorePath & storePath,
RepairFlag repair = NoRepair,
CheckSigsFlag checkSigs = CheckSigs )

Copy a path from one store to another.

◆ getDefaultSubstituters()

std::list< ref< Store > > nix::getDefaultSubstituters ( )
Returns
the default substituter stores, defined by the ‘substituters’ option and various legacy options.

◆ MakeError() [1/2]

nix::MakeError ( BuildError ,
Error  )

denotes a permanent build failure

◆ MakeError() [2/2]

nix::MakeError ( SubstError ,
Error  )

About the class hierarchy of the store types:

Each store type Foo consists of two classes:

  1. A class FooConfig : virtual StoreConfig that contains the configuration for the store

    It should only contain members of type const Setting<T> (or subclasses of it) and inherit the constructors of StoreConfig (using StoreConfig::StoreConfig).

  2. A class Foo : virtual Store, virtual FooConfig that contains the implementation of the store.

    This class is expected to have a constructor Foo(const Params & params) that calls StoreConfig(params) (otherwise you're gonna encounter an assertion failure when trying to instantiate it).

You can then register the new store using:

cpp static RegisterStoreImplementation<Foo, FooConfig> regStore;

◆ openStore() [1/2]

ref< Store > nix::openStore ( const std::string & uri = settings.storeUri.get(),
const Store::Params & extraParams = Store::Params() )

Opens the store at uri, where uri is in the format expected by StoreReference::parse

◆ openStore() [2/2]

ref< Store > nix::openStore ( StoreReference && storeURI)
Returns
a Store object to access the Nix store denoted by ‘uri’ (slight misnomer...).

◆ removeTempRoots()

void nix::removeTempRoots ( )

Remove the temporary roots file for this process. Any temporary root becomes garbage after this point unless it has been registered as a (permanent) root.

◆ resolveDerivedPath()

StorePath nix::resolveDerivedPath ( Store & ,
const SingleDerivedPath & ,
Store * evalStore = nullptr )

Resolve the derived path completely, failing if any derivation output is unknown.

◆ showPaths()

std::string nix::showPaths ( const PathSet & paths)

Display a set of paths in human-readable form (i.e., between quotes and separated by commas).

Variable Documentation

◆ exportMagic

const uint32_t nix::exportMagic = 0x4558494e

Magic header of exportPath() output (obsolete).