Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nix::DownstreamPlaceholder Class Reference

#include <downstream-placeholder.hh>

Public Member Functions

std::string render () const
 

Static Public Member Functions

static DownstreamPlaceholder unknownCaOutput (const StorePath &drvPath, OutputNameView outputName, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
 
static DownstreamPlaceholder unknownDerivation (const DownstreamPlaceholder &drvPlaceholder, OutputNameView outputName, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
 
static DownstreamPlaceholder fromSingleDerivedPathBuilt (const SingleDerivedPath::Built &built, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
 

Detailed Description

Downstream Placeholders are opaque and almost certainly unique values used to allow derivations to refer to store objects which are yet to be built and for we do not yet have store paths for.

They correspond to DerivedPaths that are not DerivedPath::Opaque, except for the cases involving input addressing or fixed outputs where we do know a store path for the derivation output in advance.

Unlike DerivationPath, however, DownstreamPlaceholder is purposefully opaque and obfuscated. This is so they are hard to create by accident, and so substituting them (once we know what the path to store object is) is unlikely to capture other stuff it shouldn't.

We use them with Derivation: the render() method is called to render an opaque string which can be used in the derivation, and the resolving logic can substitute those strings for store paths when resolving Derivation.inputDrvs to BasicDerivation.inputSrcs.

Member Function Documentation

◆ fromSingleDerivedPathBuilt()

DownstreamPlaceholder nix::DownstreamPlaceholder::fromSingleDerivedPathBuilt ( const SingleDerivedPath::Built & built,
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings )
static

Convenience constructor that handles both cases (unknown content-addressed output and unknown derivation), delegating as needed to unknownCaOutput and unknownDerivation.

Recursively builds up a placeholder from a SingleDerivedPath::Built.drvPath chain.

◆ render()

std::string nix::DownstreamPlaceholder::render ( ) const

This creates an opaque and almost certainly unique string deterministically from the placeholder.

◆ unknownCaOutput()

DownstreamPlaceholder nix::DownstreamPlaceholder::unknownCaOutput ( const StorePath & drvPath,
OutputNameView outputName,
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings )
static

Create a placeholder for an unknown output of a content-addressed derivation.

The derivation itself is known (we have a store path for it), but the output doesn't yet have a known store path.

Parameters
xpSettingsStop-gap to avoid globals during unit tests.

◆ unknownDerivation()

DownstreamPlaceholder nix::DownstreamPlaceholder::unknownDerivation ( const DownstreamPlaceholder & drvPlaceholder,
OutputNameView outputName,
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings )
static

Create a placehold for the output of an unknown derivation.

The derivation is not yet known because it is a dynamic derivaiton — it is itself an output of another derivation — and we just have (another) placeholder for it.

Parameters
xpSettingsStop-gap to avoid globals during unit tests.

The documentation for this class was generated from the following files: