aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/daemon.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-14 18:18:32 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-15 12:51:19 -0400
commit24866b71c40f0fcb5a601d90d4f87366fe626090 (patch)
tree6aef97ef7c0e00d463256ba6c876fb6e50a843f5 /src/libstore/daemon.cc
parent0f2b5146c79895ac10362b6da56b535fc3d963a4 (diff)
Introduce `SingleDrvOutputs`
In many cases we are dealing with a collection of realisations, they are all outputs of the same derivation. In that case, we don't need "derivation hashes modulos" to be part of our map key, because the output names alone will be unique. Those hashes are still part of the realisation proper, so we aren't loosing any information, we're just "normalizing our schema" by narrowing the "primary key". Besides making our data model a bit "tighter" this allows us to avoid a double `for` loop in `DerivationGoal::waiteeDone`. The inner `for` loop was previously just to select the output we cared about without knowing its hash. Now we can just select the output by name directly. Note that neither protocol is changed as part of this: we are still transferring `DrvOutputs` over the wire for `BuildResult`s. I would only consider revising this once #6223 is merged, and we can mention protocol versions inside factored-out serialization logic. Until then it is better not change anything because it would come a the cost of code reuse.
Diffstat (limited to 'src/libstore/daemon.cc')
-rw-r--r--src/libstore/daemon.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index 63898f8dc..621a59c0a 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -637,7 +637,10 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
to << res.timesBuilt << res.isNonDeterministic << res.startTime << res.stopTime;
}
if (GET_PROTOCOL_MINOR(clientVersion) >= 28) {
- worker_proto::write(*store, to, res.builtOutputs);
+ DrvOutputs builtOutputs;
+ for (auto & [output, realisation] : res.builtOutputs)
+ builtOutputs.insert_or_assign(realisation.id, realisation);
+ worker_proto::write(*store, to, builtOutputs);
}
break;
}