mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Split out UnkeyedRealisation from Realisation
Realisations are conceptually key-value pairs, mapping `DrvOutputs` (the key) to information about that derivation output. This separate the value type, which will be useful in maps, etc., where we don't want to denormalize by including the key twice. This matches similar changes for existing types: | keyed | unkeyed | |--------------------|------------------------| | `ValidPathInfo` | `UnkeyedValidPathInfo` | | `KeyedBuildResult` | `BuildResult` | | `Realisation` | `UnkeyedRealisation` |
This commit is contained in:
parent
28adcfda32
commit
e06968ec25
28 changed files with 363 additions and 251 deletions
|
|
@ -1036,7 +1036,7 @@ bool LocalStore::pathInfoIsUntrusted(const ValidPathInfo & info)
|
|||
|
||||
bool LocalStore::realisationIsUntrusted(const Realisation & realisation)
|
||||
{
|
||||
return config->requireSigs && !realisation.checkSignatures(getPublicKeys());
|
||||
return config->requireSigs && !realisation.checkSignatures(realisation.id, getPublicKeys());
|
||||
}
|
||||
|
||||
void LocalStore::addToStore(const ValidPathInfo & info, Source & source, RepairFlag repair, CheckSigsFlag checkSigs)
|
||||
|
|
@ -1586,7 +1586,7 @@ void LocalStore::addSignatures(const StorePath & storePath, const StringSet & si
|
|||
});
|
||||
}
|
||||
|
||||
std::optional<std::pair<int64_t, Realisation>>
|
||||
std::optional<std::pair<int64_t, UnkeyedRealisation>>
|
||||
LocalStore::queryRealisationCore_(LocalStore::State & state, const DrvOutput & id)
|
||||
{
|
||||
auto useQueryRealisedOutput(state.stmts->QueryRealisedOutput.use()(id.strHash())(id.outputName));
|
||||
|
|
@ -1598,14 +1598,13 @@ LocalStore::queryRealisationCore_(LocalStore::State & state, const DrvOutput & i
|
|||
|
||||
return {
|
||||
{realisationDbId,
|
||||
Realisation{
|
||||
.id = id,
|
||||
UnkeyedRealisation{
|
||||
.outPath = outputPath,
|
||||
.signatures = signatures,
|
||||
}}};
|
||||
}
|
||||
|
||||
std::optional<const Realisation> LocalStore::queryRealisation_(LocalStore::State & state, const DrvOutput & id)
|
||||
std::optional<const UnkeyedRealisation> LocalStore::queryRealisation_(LocalStore::State & state, const DrvOutput & id)
|
||||
{
|
||||
auto maybeCore = queryRealisationCore_(state, id);
|
||||
if (!maybeCore)
|
||||
|
|
@ -1631,13 +1630,13 @@ std::optional<const Realisation> LocalStore::queryRealisation_(LocalStore::State
|
|||
}
|
||||
|
||||
void LocalStore::queryRealisationUncached(
|
||||
const DrvOutput & id, Callback<std::shared_ptr<const Realisation>> callback) noexcept
|
||||
const DrvOutput & id, Callback<std::shared_ptr<const UnkeyedRealisation>> callback) noexcept
|
||||
{
|
||||
try {
|
||||
auto maybeRealisation =
|
||||
retrySQLite<std::optional<const Realisation>>([&]() { return queryRealisation_(*_state->lock(), id); });
|
||||
auto maybeRealisation = retrySQLite<std::optional<const UnkeyedRealisation>>(
|
||||
[&]() { return queryRealisation_(*_state->lock(), id); });
|
||||
if (maybeRealisation)
|
||||
callback(std::make_shared<const Realisation>(maybeRealisation.value()));
|
||||
callback(std::make_shared<const UnkeyedRealisation>(maybeRealisation.value()));
|
||||
else
|
||||
callback(nullptr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue