forked from lix-project/lix
58cdab64ac
For each known realisation, store: - its output - its output path This comes with a set of needed changes: - New `realisations` module declaring the types needed for describing these mappings - New `Store::registerDrvOutput` method registering all the needed informations about a derivation output (also replaces `LocalStore::linkDeriverToPath`) - new `Store::queryRealisation` method to retrieve the informations for a derivations This introcudes some redundancy on the remote-store side between `wopQueryDerivationOutputMap` and `wopQueryRealisation`. However we might need to keep both (regardless of backwards compat) because we sometimes need to get some infos for all the outputs of a derivation (where `wopQueryDerivationOutputMap` is handy), but all the stores can't implement it − because listing all the outputs of a derivation isn't really possible for binary caches where the server doesn't allow to list a directory.
35 lines
804 B
C++
35 lines
804 B
C++
#pragma once
|
|
|
|
#include "path.hh"
|
|
|
|
namespace nix {
|
|
|
|
struct DrvOutput {
|
|
StorePath drvPath;
|
|
std::string outputName;
|
|
|
|
std::string to_string() const;
|
|
|
|
static DrvOutput parse(const std::string &);
|
|
|
|
bool operator<(const DrvOutput& other) const { return to_pair() < other.to_pair(); }
|
|
bool operator==(const DrvOutput& other) const { return to_pair() == other.to_pair(); }
|
|
|
|
private:
|
|
// Just to make comparison operators easier to write
|
|
std::pair<StorePath, std::string> to_pair() const
|
|
{ return std::make_pair(drvPath, outputName); }
|
|
};
|
|
|
|
struct Realisation {
|
|
DrvOutput id;
|
|
StorePath outPath;
|
|
|
|
std::string to_string() const;
|
|
static Realisation parse(const std::string & s, const std::string & whence);
|
|
};
|
|
|
|
typedef std::map<DrvOutput, Realisation> DrvOutputs;
|
|
|
|
}
|