hackage-security-0.6.3.2: Hackage security library

Safe Haskell | None
Language | Haskell2010

Hackage.Security.Client.Repository.Cache

Description

The files we cache from the repository

Both the Local and the Remote repositories make use of this module.

Synopsis

- data Cache = Cache {
  - cacheRoot :: Path Absolute
  - cacheLayout :: CacheLayout
  }
- getCached :: Cache -> CachedFile -> IO (Maybe (Path Absolute))
- getCachedRoot :: Cache -> IO (Path Absolute)
- getCachedIndex :: Cache -> Format f -> IO (Maybe (Path Absolute))
- clearCache :: Cache -> IO ()
- withIndex :: Cache -> (Handle -> IO a) -> IO a
- getIndexIdx :: Cache -> IO TarIndex
- cacheRemoteFile :: DownloadedFile down => Cache -> down typ -> Format f -> IsCached typ -> IO ()
- lockCache :: Cache -> IO () -> IO ()
- lockCacheWithLogger :: (LogMessage -> IO ()) -> Cache -> IO () -> IO ()

# Documentation

data Cache Source #

Location and layout of the local cache

Constructors

Cache |

Fields

- cacheRoot :: Path Absolute
- cacheLayout :: CacheLayout

getCached :: Cache -> CachedFile -> IO (Maybe (Path Absolute)) Source #

Get a cached file (if available)

getCachedRoot :: Cache -> IO (Path Absolute) Source #

Get the cached root

Calling `getCachedRoot` without root info available is a programmer error and will result in an unchecked exception. See `requiresBootstrap`.

getCachedIndex :: Cache -> Format f -> IO (Maybe (Path Absolute)) Source #

Get the cached index (if available)

clearCache :: Cache -> IO () Source #

Delete a previously downloaded remote file

withIndex :: Cache -> (Handle -> IO a) -> IO a Source #

getIndexIdx :: Cache -> IO TarIndex Source #

cacheRemoteFile :: DownloadedFile down => Cache -> down typ -> Format f -> IsCached typ -> IO () Source #

Cache a previously downloaded remote file

lockCache :: Cache -> IO () -> IO () Source #

Lock the cache

This avoids two concurrent processes updating the cache at the same time, provided they both take the lock.

lockCacheWithLogger :: (LogMessage -> IO ()) -> Cache -> IO () -> IO () Source #

Variant of `lockCache` which emits `LogMessage`s before and after a possibly blocking file-locking system call

Since: 0.6.0