• Herbert Valerio Riedel's avatar
    Extend 01-index.cache & use 'Binary' encoding · f91e65a5
    Herbert Valerio Riedel authored
    This commit extends the index cache entries relevant for 01-index to
    include block numbers and timestamps, and makes them strict so recent
    GHCs unpack the fields:
        data IndexCacheEntry
            = CachePackageId PackageId BlockNo
            | CachePreference Dependency
            | CacheBuildTreeRef BuildTreeRefType BlockNo
       data IndexCacheEntry
           = CachePackageId PackageId !BlockNo !Timestamp
           | CachePreference Dependency !BlockNo !Timestamp
           | CacheBuildTreeRef !BuildTreeRefType !BlockNo
    For the legacy `00-index.tar`s, the 'Timestamp' field is set to (-1),
    and the original 00-index.cache format is retained.
    For (secure) `01-index.tar`s, all of `IndexCacheEntry`s data is stored
    in the `01-index.cache` file.
    Moreover, to avoid having to write out and parse new two integers per
    cache entry, this patch switches to using `Binary` instances for
    encoding the `01-index.cache` file (while `00-index.cache` remains
IndexUtils.hs 29.8 KB