aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/realisation.hh
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2020-12-09 16:56:56 +0100
committerregnat <rg@regnat.ovh>2020-12-11 21:17:23 +0100
commitbab1cda0e6c30e25460b5a9c809589d3948f35df (patch)
tree4418501c6be637b4049d34c0a132db2a9a8ddeaf /src/libstore/realisation.hh
parent8914e01e37ad072d940e2000fede7c2e0f4b194c (diff)
Use the hash modulo in the derivation outputs
Rather than storing the derivation outputs as `drvPath!outputName` internally, store them as `drvHashModulo!outputName` (or `outputHash!outputName` for fixed-output derivations). This makes the storage slightly more opaque, but enables an earlier cutoff in cases where a fixed-output dependency changes (but keeps the same output hash) − same as what we already do for input-addressed derivations.
Diffstat (limited to 'src/libstore/realisation.hh')
-rw-r--r--src/libstore/realisation.hh10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstore/realisation.hh b/src/libstore/realisation.hh
index 08579b739..4b8ead3c5 100644
--- a/src/libstore/realisation.hh
+++ b/src/libstore/realisation.hh
@@ -6,11 +6,15 @@
namespace nix {
struct DrvOutput {
- StorePath drvPath;
+ // The hash modulo of the derivation
+ Hash drvHash;
std::string outputName;
std::string to_string() const;
+ std::string strHash() const
+ { return drvHash.to_string(Base16, true); }
+
static DrvOutput parse(const std::string &);
bool operator<(const DrvOutput& other) const { return to_pair() < other.to_pair(); }
@@ -18,8 +22,8 @@ struct DrvOutput {
private:
// Just to make comparison operators easier to write
- std::pair<StorePath, std::string> to_pair() const
- { return std::make_pair(drvPath, outputName); }
+ std::pair<Hash, std::string> to_pair() const
+ { return std::make_pair(drvHash, outputName); }
};
struct Realisation {