3
3
#include " nix/util/callback.hh"
4
4
#include " nix/util/memory-source-accessor.hh"
5
5
#include " nix/store/dummy-store-impl.hh"
6
+ #include " nix/store/realisation.hh"
6
7
7
8
#include < boost/unordered/concurrent_flat_map.hpp>
8
9
@@ -251,7 +252,10 @@ struct DummyStoreImpl : DummyStore
251
252
252
253
void registerDrvOutput (const Realisation & output) override
253
254
{
254
- unsupported (" registerDrvOutput" );
255
+ auto ref = make_ref<UnkeyedRealisation>(output);
256
+ buildTrace.insert_or_visit ({output.id .drvHash , {{output.id .outputName , ref}}}, [&](auto & kv) {
257
+ kv.second .insert_or_assign (output.id .outputName , make_ref<UnkeyedRealisation>(output));
258
+ });
255
259
}
256
260
257
261
void narFromPath (const StorePath & path, Sink & sink) override
@@ -267,9 +271,18 @@ struct DummyStoreImpl : DummyStore
267
271
}
268
272
269
273
void queryRealisationUncached (
270
- const DrvOutput &, Callback<std::shared_ptr<const UnkeyedRealisation>> callback) noexcept override
274
+ const DrvOutput & drvOutput , Callback<std::shared_ptr<const UnkeyedRealisation>> callback) noexcept override
271
275
{
272
- callback (nullptr );
276
+ bool visited = false ;
277
+ buildTrace.cvisit (drvOutput.drvHash , [&](const auto & kv) {
278
+ if (auto it = kv.second .find (drvOutput.outputName ); it != kv.second .end ()) {
279
+ visited = true ;
280
+ callback (it->second .get_ptr ());
281
+ }
282
+ });
283
+
284
+ if (!visited)
285
+ callback (nullptr );
273
286
}
274
287
275
288
std::shared_ptr<SourceAccessor> getFSAccessor (const StorePath & path, bool requireValidPath) override
0 commit comments