stack-2.1.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Storage

Description

Work with SQLite database used for caches.

Synopsis

Documentation

initStorage Source #

Arguments

:: HasLogFunc env 
=> Path Abs File

storage file

-> (Storage -> RIO env a) 
-> RIO env a 

Initialize the database.

withStorage :: (HasConfig env, HasLogFunc env) => ReaderT SqlBackend (RIO env) a -> RIO env a Source #

Run an action in a database transaction

type ConfigCacheKey = Unique ConfigCacheParent Source #

Key used to retrieve configuration or flag cache

configCacheKey :: Path Abs Dir -> ConfigCacheType -> ConfigCacheKey Source #

Build key used to retrieve configuration or flag cache

loadConfigCache :: (HasConfig env, HasLogFunc env) => ConfigCacheKey -> RIO env (Maybe ConfigCache) Source #

Load ConfigCache from the database.

saveConfigCache :: (HasConfig env, HasLogFunc env) => ConfigCacheKey -> ConfigCache -> RIO env () Source #

Insert or update ConfigCache to the database.

deactiveConfigCache :: HasConfig env => ConfigCacheKey -> RIO env () Source #

Mark ConfigCache as inactive in the database. We use a flag instead of deleting the records since, in most cases, the same cache will be written again within in a few seconds (after `cabal configure`), so this avoids unnecessary database churn.

type PrecompiledCacheKey = Unique PrecompiledCacheParent Source #

Key used to retrieve the precompiled cache

precompiledCacheKey :: Path Rel Dir -> ActualCompiler -> Version -> Text -> ByteString -> Bool -> PrecompiledCacheKey Source #

Build key used to retrieve the precompiled cache

savePrecompiledCache :: (HasConfig env, HasLogFunc env) => PrecompiledCacheKey -> PrecompiledCache Rel -> RIO env () Source #

Insert or update PrecompiledCache to the database.

loadDockerImageExeCache :: (HasConfig env, HasLogFunc env) => Text -> Path Abs File -> UTCTime -> RIO env (Maybe Bool) Source #

Get the record of whether an executable is compatible with a Docker image

saveDockerImageExeCache :: (HasConfig env, HasLogFunc env) => Text -> Path Abs File -> UTCTime -> Bool -> RIO env () Source #

Sest the record of whether an executable is compatible with a Docker image

loadCompilerPaths Source #

Arguments

:: HasConfig env 
=> Path Abs File

compiler executable

-> CompilerBuild 
-> Bool

sandboxed?

-> RIO env (Maybe CompilerPaths) 

Load compiler information, if available, and confirm that the referenced files are unchanged. May throw exceptions!

saveCompilerPaths :: HasConfig env => CompilerPaths -> RIO env () Source #

Save compiler information. May throw exceptions!

upgradeChecksSince :: HasConfig env => UTCTime -> RIO env Int Source #

How many upgrade checks have occurred since the given timestamp?

logUpgradeCheck :: HasConfig env => UTCTime -> RIO env () Source #

Log in the database that an upgrade check occurred at the given time.