stack-3.9.1: A program for developing Haskell projects
LicenseBSD-3-Clause
Safe HaskellNone
LanguageGHC2024

Stack.Storage.Project

Description

Work with the SQLite database used for a project's caches.

Synopsis

Documentation

initProjectStorage Source #

Arguments

:: HasLogFunc env 
=> Path Abs File

The storage file.

-> (ProjectStorage -> RIO env a)

Action, given a SQL database connection to the project database for caches.

-> RIO env a 

Initialize the project database for caches.

type ConfigCacheKey = Unique ConfigCacheParent Source #

Type synonym representing keys used to retrieve a record from the Cabal configuration cache or the library or executable Cabal flag cache.

data ConfigCacheParent Source #

Instances

Instances details
Show ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

PersistEntity ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

SafeToInsert ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

PersistField ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

AtLeastOneUniqueKey ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

OnlyOneUniqueKey ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

PersistFieldSql ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

Methods

sqlType :: Proxy ConfigCacheParent -> SqlType

ToBackendKey SqlBackend ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

Methods

toBackendKey :: Key ConfigCacheParent -> BackendKey SqlBackend

fromBackendKey :: BackendKey SqlBackend -> Key ConfigCacheParent

SymbolToField "active" ConfigCacheParent Bool Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "directory" ConfigCacheParent FilePath Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "haddock" ConfigCacheParent Bool Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "pathEnvVar" ConfigCacheParent Text Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "pkgSrc" ConfigCacheParent CachePkgSrc Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "type" ConfigCacheParent ConfigCacheType Source # 
Instance details

Defined in Stack.Storage.Project

SymbolToField "id" ConfigCacheParent (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

FromJSON (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

ToJSON (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

Read (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

Show (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

Eq (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

Ord (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

FromHttpApiData (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

ToHttpApiData (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

PathPiece (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

PersistField (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

PersistFieldSql (Key ConfigCacheParent) Source # 
Instance details

Defined in Stack.Storage.Project

Methods

sqlType :: Proxy (Key ConfigCacheParent) -> SqlType

data EntityField ConfigCacheParent typ Source # 
Instance details

Defined in Stack.Storage.Project

newtype Key ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

type PersistEntityBackend ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

type PersistEntityBackend ConfigCacheParent = SqlBackend
data Unique ConfigCacheParent Source # 
Instance details

Defined in Stack.Storage.Project

configCacheKey Source #

Arguments

:: Path Abs Dir

Directory.

-> ConfigCacheType

Type of cache.

-> ConfigCacheKey 

For the given directory and type of cache, yields the key used to retrieve a record from the Cabal configuration cache or the library or executable Cabal flag cache.

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

Load a ConfigCache value from the project database for caches.

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

Insert or update a ConfigCache value to the project database for caches.

deactiveConfigCache :: HasBuildConfig 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.