Skip to content

driver: Introduce HomeModInfoCache abstraction

Matthew Pickering requested to merge wip/t20780 into master

The HomeModInfoCache is a mutable cache which is updated incrementally as the driver completes, this makes it robust to exceptions including (SIGINT)

The interface for the cache is described by the HomeMOdInfoCache data type:

data HomeModInfoCache = HomeModInfoCache { hmi_clearCache :: IO [HomeModInfo]
                                         , hmi_addToCache :: HomeModInfo -> IO () }

The first operation clears the cache and returns its contents. This is designed so it's harder to end up in situations where the cache is retained throughout the execution of upsweep.

The second operation allows a module to be added to the cache.

The one slightly nasty part is in interpretBuildPlan where we have to be careful to ensure that the cache writes happen:

  1. In parralel
  2. Before the executation continues after upsweep.

This requires some simple, localised MVar wrangling.

Fixes #20780 (closed)

Merge request reports