pantry-0.4.0.2: Content addressable Haskell package management

Safe Haskell | None
Language | Haskell2010

Pantry.Internal.Stackage

Description

All types and functions exported from this module are for advanced usage only. They are needed for stackage-server integration with pantry.

Synopsis

- data family Unique record
- data family EntityField record :: Type -> Type
- data family Key record
- data SafeFilePath
- newtype ModuleNameP = ModuleNameP {
  - unModuleNameP :: ModuleName
  }
- newtype VersionP = VersionP {
  - unVersionP :: Version
  }
- newtype PackageNameP = PackageNameP {
  - unPackageNameP :: PackageName
  }
- data PantryConfig = PantryConfig {
  - pcHackageSecurity :: !HackageSecurityConfig
  - pcHpackExecutable :: !HpackExecutable
  - pcRootDir :: !(Path Abs Dir)
  - pcStorage :: !Storage
  - pcUpdateRef :: !(MVar Bool)
  - pcParsedCabalFilesRawImmutable :: !(IORef (Map RawPackageLocationImmutable GenericPackageDescription))
  - pcParsedCabalFilesMutable :: !(IORef (Map (Path Abs Dir) (PrintWarnings -> IO GenericPackageDescription, PackageName, Path Abs File)))
  - pcConnectionCount :: !Int
  - pcCasaRepoPrefix :: !CasaRepoPrefix
  - pcCasaMaxPerRequest :: !Int
  }
- data Storage = Storage {
  - withStorage_ :: forall env a. HasLogFunc env => ReaderT SqlBackend (RIO env) a -> RIO env a
  - withWriteLock_ :: forall env a. HasLogFunc env => RIO env a -> RIO env a
  }
- packageTreeKey :: Package -> TreeKey
- unSafeFilePath :: SafeFilePath -> Text
- mkSafeFilePath :: Text -> Maybe SafeFilePath
- type ModuleNameId = Key ModuleName
- type TreeEntryId = Key TreeEntry
- type TreeId = Key Tree
- data Tree = Tree {
  - treeKey :: !(Key Blob)
  - treeCabal :: !(Maybe (Key Blob))
  - treeCabalType :: !FileType
  - treeName :: !(Key PackageName)
  - treeVersion :: !(Key Version)
  }
- type HackageCabalId = Key HackageCabal
- type VersionId = Key Version
- data Version
- type PackageNameId = Key PackageName
- data PackageName
- type BlobId = Key Blob
- migrateAll :: Migration
- getPackageNameById :: PackageNameId -> ReaderT SqlBackend (RIO env) (Maybe PackageName)
- getPackageNameId :: PackageName -> ReaderT SqlBackend (RIO env) PackageNameId
- getVersionId :: Version -> ReaderT SqlBackend (RIO env) VersionId
- storeBlob :: ByteString -> ReaderT SqlBackend (RIO env) (BlobId, BlobKey)
- loadBlobById :: BlobId -> ReaderT SqlBackend (RIO env) ByteString
- getBlobKey :: BlobId -> ReaderT SqlBackend (RIO env) BlobKey
- getTreeForKey :: TreeKey -> ReaderT SqlBackend (RIO env) (Maybe (Entity Tree))
- data HackageTarballResult = HackageTarballResult {
  - htrPackage :: !Package
  - htrFreshPackageInfo :: !(Maybe (GenericPackageDescription, TreeId))
  }
- forceUpdateHackageIndex :: (HasPantryConfig env, HasLogFunc env) => Maybe Utf8Builder -> RIO env DidUpdateOccur
- getHackageTarball :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageIdentifierRevision -> Maybe TreeKey -> RIO env HackageTarballResult

# Documentation

data family Unique record Source #

Unique keys besides the `Key`.

#### Instances

Instances details

Show (Unique Tree) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique Tree -> ShowS Source # show :: Unique Tree -> String Source # showList :: [Unique Tree] -> ShowS Source #
Show (Unique Version) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique Version -> ShowS Source # show :: Unique Version -> String Source # showList :: [Unique Version] -> ShowS Source #
Show (Unique PackageName) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique PackageName -> ShowS Source # show :: Unique PackageName -> String Source # showList :: [Unique PackageName] -> ShowS Source #
data Unique Tree Source # |
Instance details Defined in Pantry.Storage data Unique Tree = UniqueTree (Key Blob)
data Unique Version Source # |
Instance details Defined in Pantry.Storage data Unique Version = UniqueVersion VersionP
data Unique PackageName Source # |
Instance details Defined in Pantry.Storage data Unique PackageName = UniquePackageName PackageNameP

data family EntityField record :: Type -> Type Source #

An `EntityField` is parameterised by the Haskell record it belongs to and the additional type of that field.

#### Instances

Instances details

data EntityField Tree typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField Tree typ

- = typ ~ Key Tree => TreeId
- | typ ~ Key Blob => TreeKey
- | typ ~ Maybe (Key Blob) => TreeCabal
- | typ ~ FileType => TreeCabalType
- | typ ~ Key PackageName => TreeName
- | typ ~ Key Version => TreeVersion

data EntityField Version typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField Version typ

- = typ ~ Key Version => VersionId
- | typ ~ VersionP => VersionVersion

data EntityField PackageName typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField PackageName typ

- = typ ~ Key PackageName => PackageNameId
- | typ ~ PackageNameP => PackageNameName

data family Key record Source #

By default, a backend will automatically generate the key Instead you can specify a Primary key made up of unique values.

#### Instances

Instances details

Eq (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key Tree -> Key Tree -> Bool Source # (/=) :: Key Tree -> Key Tree -> Bool Source #
Eq (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key Version -> Key Version -> Bool Source # (/=) :: Key Version -> Key Version -> Bool Source #
Eq (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key PackageName -> Key PackageName -> Bool Source # (/=) :: Key PackageName -> Key PackageName -> Bool Source #
Ord (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods compare :: Key Tree -> Key Tree -> Ordering Source # (<) :: Key Tree -> Key Tree -> Bool Source # (<=) :: Key Tree -> Key Tree -> Bool Source # (>) :: Key Tree -> Key Tree -> Bool Source # (>=) :: Key Tree -> Key Tree -> Bool Source # max :: Key Tree -> Key Tree -> Key Tree Source # min :: Key Tree -> Key Tree -> Key Tree Source #
Ord (Key Version) Source # |

Instance details

Defined in Pantry.Storage

Methods

compare :: Key Version -> Key Version -> Ordering Source #

(<) :: Key Version -> Key Version -> Bool Source #

(<=) :: Key Version -> Key Version -> Bool Source #

(>) :: Key Version -> Key Version -> Bool Source #

(>=) :: Key Version -> Key Version -> Bool Source #

max :: Key Version -> Key Version -> Key Version Source #

min :: Key Version -> Key Version -> Key Version Source #

Ord (Key PackageName) Source # |

Instance details

Defined in Pantry.Storage

Methods

compare :: Key PackageName -> Key PackageName -> Ordering Source #

(<) :: Key PackageName -> Key PackageName -> Bool Source #

(<=) :: Key PackageName -> Key PackageName -> Bool Source #

(>) :: Key PackageName -> Key PackageName -> Bool Source #

(>=) :: Key PackageName -> Key PackageName -> Bool Source #

max :: Key PackageName -> Key PackageName -> Key PackageName Source #

min :: Key PackageName -> Key PackageName -> Key PackageName Source #

Read (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key Tree) Source # readList :: ReadS [Key Tree] Source # readPrec :: ReadPrec (Key Tree) Source # readListPrec :: ReadPrec [Key Tree] Source #
Read (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key Version) Source # readList :: ReadS [Key Version] Source # readPrec :: ReadPrec (Key Version) Source # readListPrec :: ReadPrec [Key Version] Source #
Read (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key PackageName) Source # readList :: ReadS [Key PackageName] Source # readPrec :: ReadPrec (Key PackageName) Source # readListPrec :: ReadPrec [Key PackageName] Source #
Show (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key Tree -> ShowS Source # show :: Key Tree -> String Source # showList :: [Key Tree] -> ShowS Source #
Show (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key Version -> ShowS Source # show :: Key Version -> String Source # showList :: [Key Version] -> ShowS Source #
Show (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key PackageName -> ShowS Source # show :: Key PackageName -> String Source # showList :: [Key PackageName] -> ShowS Source #
ToJSON (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key Tree -> Value Source # toEncoding :: Key Tree -> Encoding Source # toJSONList :: [Key Tree] -> Value Source # toEncodingList :: [Key Tree] -> Encoding Source #
ToJSON (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key Version -> Value Source # toEncoding :: Key Version -> Encoding Source # toJSONList :: [Key Version] -> Value Source # toEncodingList :: [Key Version] -> Encoding Source #
ToJSON (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key PackageName -> Value Source # toEncoding :: Key PackageName -> Encoding Source # toJSONList :: [Key PackageName] -> Value Source # toEncodingList :: [Key PackageName] -> Encoding Source #
FromJSON (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key Tree) Source # parseJSONList :: Value -> Parser [Key Tree] Source #
FromJSON (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key Version) Source # parseJSONList :: Value -> Parser [Key Version] Source #
FromJSON (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key PackageName) Source # parseJSONList :: Value -> Parser [Key PackageName] Source #
(PersistEntity a, PersistEntityBackend a ~ backend, IsPersistBackend backend) => RawSql (Key a) |
Instance details Defined in Database.Persist.Sql.Class Methods rawSqlCols :: (DBName -> Text) -> Key a -> (Int, [Text]) Source # rawSqlColCountReason :: Key a -> String Source # rawSqlProcessRow :: [PersistValue] -> Either Text (Key a) Source #
PersistFieldSql (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key Tree) -> SqlType Source #
PersistFieldSql (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key Version) -> SqlType Source #
PersistFieldSql (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key PackageName) -> SqlType Source #
PersistField (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key Tree -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key Tree) Source #
PersistField (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key Version -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key Version) Source #
PersistField (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key PackageName -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key PackageName) Source #
FromHttpApiData (Key Tree) |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key Tree) parseHeader :: ByteString -> Either Text (Key Tree) parseQueryParam :: Text -> Either Text (Key Tree)
FromHttpApiData (Key Version) |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key Version) parseHeader :: ByteString -> Either Text (Key Version) parseQueryParam :: Text -> Either Text (Key Version)
FromHttpApiData (Key PackageName) |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key PackageName) parseHeader :: ByteString -> Either Text (Key PackageName) parseQueryParam :: Text -> Either Text (Key PackageName)
ToHttpApiData (Key Tree) |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key Tree -> Text toEncodedUrlPiece :: Key Tree -> Builder toHeader :: Key Tree -> ByteString toQueryParam :: Key Tree -> Text
ToHttpApiData (Key Version) |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key Version -> Text toEncodedUrlPiece :: Key Version -> Builder toHeader :: Key Version -> ByteString toQueryParam :: Key Version -> Text
ToHttpApiData (Key PackageName) |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key PackageName -> Text toEncodedUrlPiece :: Key PackageName -> Builder toHeader :: Key PackageName -> ByteString toQueryParam :: Key PackageName -> Text
PathPiece (Key Tree) |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key Tree) toPathPiece :: Key Tree -> Text
PathPiece (Key Version) |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key Version) toPathPiece :: Key Version -> Text
PathPiece (Key PackageName) |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key PackageName) toPathPiece :: Key PackageName -> Text
newtype Key Tree Source # |

Instance details

Defined in Pantry.Storage

newtype Key Tree = TreeKey' {

- unTreeKey :: BackendKey SqlBackend

}

newtype Key Version Source # |

Instance details

Defined in Pantry.Storage

newtype Key Version = VersionKey {

- unVersionKey :: BackendKey SqlBackend

}

newtype Key PackageName Source # |

Instance details

Defined in Pantry.Storage

newtype Key PackageName = PackageNameKey {

- unPackageNameKey :: BackendKey SqlBackend

}

data SafeFilePath Source #

#### Instances

Instances details

Eq SafeFilePath Source # |
Instance details Defined in Pantry.Types Methods (==) :: SafeFilePath -> SafeFilePath -> Bool Source # (/=) :: SafeFilePath -> SafeFilePath -> Bool Source #
Ord SafeFilePath Source # |

Instance details

Defined in Pantry.Types

Methods

compare :: SafeFilePath -> SafeFilePath -> Ordering Source #

(<) :: SafeFilePath -> SafeFilePath -> Bool Source #

(<=) :: SafeFilePath -> SafeFilePath -> Bool Source #

(>) :: SafeFilePath -> SafeFilePath -> Bool Source #

(>=) :: SafeFilePath -> SafeFilePath -> Bool Source #

max :: SafeFilePath -> SafeFilePath -> SafeFilePath Source #

min :: SafeFilePath -> SafeFilePath -> SafeFilePath Source #

Show SafeFilePath Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> SafeFilePath -> ShowS Source # show :: SafeFilePath -> String Source # showList :: [SafeFilePath] -> ShowS Source #
PersistFieldSql SafeFilePath Source # |
Instance details Defined in Pantry.Types Methods sqlType :: Proxy SafeFilePath -> SqlType Source #
PersistField SafeFilePath Source # |
Instance details Defined in Pantry.Types Methods toPersistValue :: SafeFilePath -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text SafeFilePath Source #
Display SafeFilePath Source # |
Instance details Defined in Pantry.Types Methods display :: SafeFilePath -> Utf8Builder Source # textDisplay :: SafeFilePath -> Text Source #

newtype ModuleNameP Source #

Constructors

ModuleNameP |

Fields

- unModuleNameP :: ModuleName

#### Instances

Instances details

Eq ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods (==) :: ModuleNameP -> ModuleNameP -> Bool Source # (/=) :: ModuleNameP -> ModuleNameP -> Bool Source #
Ord ModuleNameP Source # |

Instance details

Defined in Pantry.Types

Methods

compare :: ModuleNameP -> ModuleNameP -> Ordering Source #

(<) :: ModuleNameP -> ModuleNameP -> Bool Source #

(<=) :: ModuleNameP -> ModuleNameP -> Bool Source #

(>) :: ModuleNameP -> ModuleNameP -> Bool Source #

(>=) :: ModuleNameP -> ModuleNameP -> Bool Source #

max :: ModuleNameP -> ModuleNameP -> ModuleNameP Source #

min :: ModuleNameP -> ModuleNameP -> ModuleNameP Source #

Show ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> ModuleNameP -> ShowS Source # show :: ModuleNameP -> String Source # showList :: [ModuleNameP] -> ShowS Source #
NFData ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods rnf :: ModuleNameP -> () Source #
PersistFieldSql ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods sqlType :: Proxy ModuleNameP -> SqlType Source #
PersistField ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods toPersistValue :: ModuleNameP -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text ModuleNameP Source #
Display ModuleNameP Source # |
Instance details Defined in Pantry.Types Methods display :: ModuleNameP -> Utf8Builder Source # textDisplay :: ModuleNameP -> Text Source #

newtype VersionP Source #

Constructors

VersionP |

Fields

- unVersionP :: Version

#### Instances

Instances details

Eq VersionP Source # |
Instance details Defined in Pantry.Types Methods (==) :: VersionP -> VersionP -> Bool Source # (/=) :: VersionP -> VersionP -> Bool Source #
Ord VersionP Source # |
Instance details Defined in Pantry.Types Methods compare :: VersionP -> VersionP -> Ordering Source # (<) :: VersionP -> VersionP -> Bool Source # (<=) :: VersionP -> VersionP -> Bool Source # (>) :: VersionP -> VersionP -> Bool Source # (>=) :: VersionP -> VersionP -> Bool Source # max :: VersionP -> VersionP -> VersionP Source # min :: VersionP -> VersionP -> VersionP Source #
Read VersionP Source # |
Instance details Defined in Pantry.Types Methods readsPrec :: Int -> ReadS VersionP Source # readList :: ReadS [VersionP] Source # readPrec :: ReadPrec VersionP Source # readListPrec :: ReadPrec [VersionP] Source #
Show VersionP Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> VersionP -> ShowS Source # show :: VersionP -> String Source # showList :: [VersionP] -> ShowS Source #
NFData VersionP Source # |
Instance details Defined in Pantry.Types Methods rnf :: VersionP -> () Source #
ToJSON VersionP Source # |
Instance details Defined in Pantry.Types Methods toJSON :: VersionP -> Value Source # toEncoding :: VersionP -> Encoding Source # toJSONList :: [VersionP] -> Value Source # toEncodingList :: [VersionP] -> Encoding Source #
FromJSON VersionP Source # |
Instance details Defined in Pantry.Types Methods parseJSON :: Value -> Parser VersionP Source # parseJSONList :: Value -> Parser [VersionP] Source #
PersistFieldSql VersionP Source # |
Instance details Defined in Pantry.Types Methods sqlType :: Proxy VersionP -> SqlType Source #
PersistField VersionP Source # |
Instance details Defined in Pantry.Types Methods toPersistValue :: VersionP -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text VersionP Source #
Display VersionP Source # |
Instance details Defined in Pantry.Types Methods display :: VersionP -> Utf8Builder Source # textDisplay :: VersionP -> Text Source #

newtype PackageNameP Source #

Constructors

PackageNameP |

Fields

- unPackageNameP :: PackageName

#### Instances

Instances details

Eq PackageNameP Source # |
Instance details Defined in Pantry.Types Methods (==) :: PackageNameP -> PackageNameP -> Bool Source # (/=) :: PackageNameP -> PackageNameP -> Bool Source #
Ord PackageNameP Source # |

Instance details

Defined in Pantry.Types

Methods

compare :: PackageNameP -> PackageNameP -> Ordering Source #

(<) :: PackageNameP -> PackageNameP -> Bool Source #

(<=) :: PackageNameP -> PackageNameP -> Bool Source #

(>) :: PackageNameP -> PackageNameP -> Bool Source #

(>=) :: PackageNameP -> PackageNameP -> Bool Source #

max :: PackageNameP -> PackageNameP -> PackageNameP Source #

min :: PackageNameP -> PackageNameP -> PackageNameP Source #

Read PackageNameP Source # |
Instance details Defined in Pantry.Types Methods readsPrec :: Int -> ReadS PackageNameP Source # readList :: ReadS [PackageNameP] Source # readPrec :: ReadPrec PackageNameP Source # readListPrec :: ReadPrec [PackageNameP] Source #
Show PackageNameP Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> PackageNameP -> ShowS Source # show :: PackageNameP -> String Source # showList :: [PackageNameP] -> ShowS Source #
NFData PackageNameP Source # |
Instance details Defined in Pantry.Types Methods rnf :: PackageNameP -> () Source #
ToJSON PackageNameP Source # |
Instance details Defined in Pantry.Types Methods toJSON :: PackageNameP -> Value Source # toEncoding :: PackageNameP -> Encoding Source # toJSONList :: [PackageNameP] -> Value Source # toEncodingList :: [PackageNameP] -> Encoding Source #
ToJSONKey PackageNameP Source # |
Instance details Defined in Pantry.Types Methods toJSONKey :: ToJSONKeyFunction PackageNameP Source # toJSONKeyList :: ToJSONKeyFunction [PackageNameP] Source #
FromJSON PackageNameP Source # |
Instance details Defined in Pantry.Types Methods parseJSON :: Value -> Parser PackageNameP Source # parseJSONList :: Value -> Parser [PackageNameP] Source #
FromJSONKey PackageNameP Source # |
Instance details Defined in Pantry.Types Methods fromJSONKey :: FromJSONKeyFunction PackageNameP Source # fromJSONKeyList :: FromJSONKeyFunction [PackageNameP] Source #
PersistFieldSql PackageNameP Source # |
Instance details Defined in Pantry.Types Methods sqlType :: Proxy PackageNameP -> SqlType Source #
PersistField PackageNameP Source # |
Instance details Defined in Pantry.Types Methods toPersistValue :: PackageNameP -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text PackageNameP Source #
Display PackageNameP Source # |
Instance details Defined in Pantry.Types Methods display :: PackageNameP -> Utf8Builder Source # textDisplay :: PackageNameP -> Text Source #

data PantryConfig Source #

Configuration value used by the entire pantry package. Create one using `withPantryConfig`. See also `PantryApp` for a convenience approach to using pantry.

Since: 0.1.0.0

Constructors

PantryConfig |

Fields

- pcHackageSecurity :: !HackageSecurityConfig
- pcHpackExecutable :: !HpackExecutable
- pcRootDir :: !(Path Abs Dir)
- pcStorage :: !Storage
- pcUpdateRef :: !(MVar Bool)

  Want to try updating the index once during a single run for missing package identifiers. We also want to ensure we only update once at a time. Start at `True`.

- pcParsedCabalFilesRawImmutable :: !(IORef (Map RawPackageLocationImmutable GenericPackageDescription))

  Cache of previously parsed cabal files, to save on slow parsing time.

- pcParsedCabalFilesMutable :: !(IORef (Map (Path Abs Dir) (PrintWarnings -> IO GenericPackageDescription, PackageName, Path Abs File)))

  Cache for mutable packages. We want to allow for an optimization: deferring parsing of the `GenericPackageDescription` until its actually needed. Therefore, we keep the filepath and the `PackageName` derived from that filepath. When the `IO GenericPackageDescription` is run, it will ensure that the `PackageName` matches the value inside the cabal file, and print out any warnings that still need to be printed.

- pcConnectionCount :: !Int

  concurrently open downloads

- pcCasaRepoPrefix :: !CasaRepoPrefix

  The pull URL e.g. `https://casa.fpcomplete.com/v1/pull`

- pcCasaMaxPerRequest :: !Int

  Maximum blobs sent per pull request.

data Storage Source #

Represents a SQL database connection. This used to be a newtype wrapper around a connection pool. However, when investigating https://github.com/commercialhaskell/stack/issues/4471, it appeared that holding a pool resulted in overly long write locks being held on the database. As a result, we now abstract away whether a pool is used, and the default implementation in Pantry.Storage does not use a pool.

Constructors

Storage |

Fields

- withStorage_ :: forall env a. HasLogFunc env => ReaderT SqlBackend (RIO env) a -> RIO env a
- withWriteLock_ :: forall env a. HasLogFunc env => RIO env a -> RIO env a

packageTreeKey :: Package -> TreeKey Source #

The `TreeKey` containing this package.

This is a hash of the binary representation of `packageTree`.

Since: 0.1.0.0

unSafeFilePath :: SafeFilePath -> Text Source #

mkSafeFilePath :: Text -> Maybe SafeFilePath Source #

type ModuleNameId = Key ModuleName Source #

type TreeEntryId = Key TreeEntry Source #

type TreeId = Key Tree Source #

data Tree Source #

Constructors

Tree |

Fields

- treeKey :: !(Key Blob)
- treeCabal :: !(Maybe (Key Blob))
- treeCabalType :: !FileType
- treeName :: !(Key PackageName)
- treeVersion :: !(Key Version)

#### Instances

Instances details

PersistFieldSql Tree Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy Tree -> SqlType Source #
OnlyOneUniqueKey Tree Source # |
Instance details Defined in Pantry.Storage Methods onlyUniqueP :: Tree -> Unique Tree Source #
AtLeastOneUniqueKey Tree Source # |
Instance details Defined in Pantry.Storage Methods requireUniquesP :: Tree -> NonEmpty (Unique Tree) Source #
PersistEntity Tree Source # |

Instance details

Defined in Pantry.Storage

Associated Types

type PersistEntityBackend Tree Source #

data Key Tree Source #

data EntityField Tree :: Type -> Type Source #

data Unique Tree Source #

Methods

keyToValues :: Key Tree -> [PersistValue] Source #

keyFromValues :: [PersistValue] -> Either Text (Key Tree) Source #

persistIdField :: EntityField Tree (Key Tree) Source #

entityDef :: Monad m => m Tree -> EntityDef Source #

persistFieldDef :: EntityField Tree typ -> FieldDef Source #

toPersistFields :: Tree -> [SomePersistField] Source #

fromPersistValues :: [PersistValue] -> Either Text Tree Source #

persistUniqueKeys :: Tree -> [Unique Tree] Source #

persistUniqueToFieldNames :: Unique Tree -> [(HaskellName, DBName)] Source #

persistUniqueToValues :: Unique Tree -> [PersistValue] Source #

fieldLens :: EntityField Tree field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity Tree -> f (Entity Tree) Source #

PersistField Tree Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Tree -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text Tree Source #
ToBackendKey SqlBackend Tree Source # |
Instance details Defined in Pantry.Storage Methods toBackendKey :: Key Tree -> BackendKey SqlBackend Source # fromBackendKey :: BackendKey SqlBackend -> Key Tree Source #
Eq (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key Tree -> Key Tree -> Bool Source # (/=) :: Key Tree -> Key Tree -> Bool Source #
Ord (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods compare :: Key Tree -> Key Tree -> Ordering Source # (<) :: Key Tree -> Key Tree -> Bool Source # (<=) :: Key Tree -> Key Tree -> Bool Source # (>) :: Key Tree -> Key Tree -> Bool Source # (>=) :: Key Tree -> Key Tree -> Bool Source # max :: Key Tree -> Key Tree -> Key Tree Source # min :: Key Tree -> Key Tree -> Key Tree Source #
Read (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key Tree) Source # readList :: ReadS [Key Tree] Source # readPrec :: ReadPrec (Key Tree) Source # readListPrec :: ReadPrec [Key Tree] Source #
Show (Unique Tree) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique Tree -> ShowS Source # show :: Unique Tree -> String Source # showList :: [Unique Tree] -> ShowS Source #
Show (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key Tree -> ShowS Source # show :: Key Tree -> String Source # showList :: [Key Tree] -> ShowS Source #
ToJSON (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key Tree -> Value Source # toEncoding :: Key Tree -> Encoding Source # toJSONList :: [Key Tree] -> Value Source # toEncodingList :: [Key Tree] -> Encoding Source #
FromJSON (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key Tree) Source # parseJSONList :: Value -> Parser [Key Tree] Source #
PersistFieldSql (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key Tree) -> SqlType Source #
PersistField (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key Tree -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key Tree) Source #
FromHttpApiData (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key Tree) parseHeader :: ByteString -> Either Text (Key Tree) parseQueryParam :: Text -> Either Text (Key Tree)
ToHttpApiData (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key Tree -> Text toEncodedUrlPiece :: Key Tree -> Builder toHeader :: Key Tree -> ByteString toQueryParam :: Key Tree -> Text
PathPiece (Key Tree) Source # |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key Tree) toPathPiece :: Key Tree -> Text
data Unique Tree Source # |
Instance details Defined in Pantry.Storage data Unique Tree = UniqueTree (Key Blob)
data EntityField Tree typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField Tree typ

- = typ ~ Key Tree => TreeId
- | typ ~ Key Blob => TreeKey
- | typ ~ Maybe (Key Blob) => TreeCabal
- | typ ~ FileType => TreeCabalType
- | typ ~ Key PackageName => TreeName
- | typ ~ Key Version => TreeVersion

newtype Key Tree Source # |

Instance details

Defined in Pantry.Storage

newtype Key Tree = TreeKey' {

- unTreeKey :: BackendKey SqlBackend

}

type PersistEntityBackend Tree Source # |
Instance details Defined in Pantry.Storage type PersistEntityBackend Tree = SqlBackend

type HackageCabalId = Key HackageCabal Source #

type VersionId = Key Version Source #

data Version Source #

#### Instances

Instances details

PersistFieldSql Version Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy Version -> SqlType Source #
OnlyOneUniqueKey Version Source # |
Instance details Defined in Pantry.Storage Methods onlyUniqueP :: Version -> Unique Version Source #
AtLeastOneUniqueKey Version Source # |
Instance details Defined in Pantry.Storage Methods requireUniquesP :: Version -> NonEmpty (Unique Version) Source #
PersistEntity Version Source # |

Instance details

Defined in Pantry.Storage

Associated Types

type PersistEntityBackend Version Source #

data Key Version Source #

data EntityField Version :: Type -> Type Source #

data Unique Version Source #

Methods

keyToValues :: Key Version -> [PersistValue] Source #

keyFromValues :: [PersistValue] -> Either Text (Key Version) Source #

persistIdField :: EntityField Version (Key Version) Source #

entityDef :: Monad m => m Version -> EntityDef Source #

persistFieldDef :: EntityField Version typ -> FieldDef Source #

toPersistFields :: Version -> [SomePersistField] Source #

fromPersistValues :: [PersistValue] -> Either Text Version Source #

persistUniqueKeys :: Version -> [Unique Version] Source #

persistUniqueToFieldNames :: Unique Version -> [(HaskellName, DBName)] Source #

persistUniqueToValues :: Unique Version -> [PersistValue] Source #

fieldLens :: EntityField Version field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity Version -> f (Entity Version) Source #

PersistField Version Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Version -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text Version Source #
ToBackendKey SqlBackend Version Source # |
Instance details Defined in Pantry.Storage Methods toBackendKey :: Key Version -> BackendKey SqlBackend Source # fromBackendKey :: BackendKey SqlBackend -> Key Version Source #
Eq (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key Version -> Key Version -> Bool Source # (/=) :: Key Version -> Key Version -> Bool Source #
Ord (Key Version) Source # |

Instance details

Defined in Pantry.Storage

Methods

compare :: Key Version -> Key Version -> Ordering Source #

(<) :: Key Version -> Key Version -> Bool Source #

(<=) :: Key Version -> Key Version -> Bool Source #

(>) :: Key Version -> Key Version -> Bool Source #

(>=) :: Key Version -> Key Version -> Bool Source #

max :: Key Version -> Key Version -> Key Version Source #

min :: Key Version -> Key Version -> Key Version Source #

Read (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key Version) Source # readList :: ReadS [Key Version] Source # readPrec :: ReadPrec (Key Version) Source # readListPrec :: ReadPrec [Key Version] Source #
Show (Unique Version) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique Version -> ShowS Source # show :: Unique Version -> String Source # showList :: [Unique Version] -> ShowS Source #
Show (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key Version -> ShowS Source # show :: Key Version -> String Source # showList :: [Key Version] -> ShowS Source #
ToJSON (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key Version -> Value Source # toEncoding :: Key Version -> Encoding Source # toJSONList :: [Key Version] -> Value Source # toEncodingList :: [Key Version] -> Encoding Source #
FromJSON (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key Version) Source # parseJSONList :: Value -> Parser [Key Version] Source #
PersistFieldSql (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key Version) -> SqlType Source #
PersistField (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key Version -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key Version) Source #
FromHttpApiData (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key Version) parseHeader :: ByteString -> Either Text (Key Version) parseQueryParam :: Text -> Either Text (Key Version)
ToHttpApiData (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key Version -> Text toEncodedUrlPiece :: Key Version -> Builder toHeader :: Key Version -> ByteString toQueryParam :: Key Version -> Text
PathPiece (Key Version) Source # |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key Version) toPathPiece :: Key Version -> Text
data Unique Version Source # |
Instance details Defined in Pantry.Storage data Unique Version = UniqueVersion VersionP
data EntityField Version typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField Version typ

- = typ ~ Key Version => VersionId
- | typ ~ VersionP => VersionVersion

newtype Key Version Source # |

Instance details

Defined in Pantry.Storage

newtype Key Version = VersionKey {

- unVersionKey :: BackendKey SqlBackend

}

type PersistEntityBackend Version Source # |
Instance details Defined in Pantry.Storage type PersistEntityBackend Version = SqlBackend

type PackageNameId = Key PackageName Source #

data PackageName Source #

#### Instances

Instances details

PersistFieldSql PackageName Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy PackageName -> SqlType Source #
OnlyOneUniqueKey PackageName Source # |
Instance details Defined in Pantry.Storage Methods onlyUniqueP :: PackageName -> Unique PackageName Source #
AtLeastOneUniqueKey PackageName Source # |
Instance details Defined in Pantry.Storage Methods requireUniquesP :: PackageName -> NonEmpty (Unique PackageName) Source #
PersistEntity PackageName Source # |

Instance details

Defined in Pantry.Storage

Associated Types

type PersistEntityBackend PackageName Source #

data Key PackageName Source #

data EntityField PackageName :: Type -> Type Source #

data Unique PackageName Source #

Methods

keyToValues :: Key PackageName -> [PersistValue] Source #

keyFromValues :: [PersistValue] -> Either Text (Key PackageName) Source #

persistIdField :: EntityField PackageName (Key PackageName) Source #

entityDef :: Monad m => m PackageName -> EntityDef Source #

persistFieldDef :: EntityField PackageName typ -> FieldDef Source #

toPersistFields :: PackageName -> [SomePersistField] Source #

fromPersistValues :: [PersistValue] -> Either Text PackageName Source #

persistUniqueKeys :: PackageName -> [Unique PackageName] Source #

persistUniqueToFieldNames :: Unique PackageName -> [(HaskellName, DBName)] Source #

persistUniqueToValues :: Unique PackageName -> [PersistValue] Source #

fieldLens :: EntityField PackageName field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity PackageName -> f (Entity PackageName) Source #

PersistField PackageName Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: PackageName -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text PackageName Source #
ToBackendKey SqlBackend PackageName Source # |
Instance details Defined in Pantry.Storage Methods toBackendKey :: Key PackageName -> BackendKey SqlBackend Source # fromBackendKey :: BackendKey SqlBackend -> Key PackageName Source #
Eq (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods (==) :: Key PackageName -> Key PackageName -> Bool Source # (/=) :: Key PackageName -> Key PackageName -> Bool Source #
Ord (Key PackageName) Source # |

Instance details

Defined in Pantry.Storage

Methods

compare :: Key PackageName -> Key PackageName -> Ordering Source #

(<) :: Key PackageName -> Key PackageName -> Bool Source #

(<=) :: Key PackageName -> Key PackageName -> Bool Source #

(>) :: Key PackageName -> Key PackageName -> Bool Source #

(>=) :: Key PackageName -> Key PackageName -> Bool Source #

max :: Key PackageName -> Key PackageName -> Key PackageName Source #

min :: Key PackageName -> Key PackageName -> Key PackageName Source #

Read (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods readsPrec :: Int -> ReadS (Key PackageName) Source # readList :: ReadS [Key PackageName] Source # readPrec :: ReadPrec (Key PackageName) Source # readListPrec :: ReadPrec [Key PackageName] Source #
Show (Unique PackageName) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Unique PackageName -> ShowS Source # show :: Unique PackageName -> String Source # showList :: [Unique PackageName] -> ShowS Source #
Show (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods showsPrec :: Int -> Key PackageName -> ShowS Source # show :: Key PackageName -> String Source # showList :: [Key PackageName] -> ShowS Source #
ToJSON (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods toJSON :: Key PackageName -> Value Source # toEncoding :: Key PackageName -> Encoding Source # toJSONList :: [Key PackageName] -> Value Source # toEncodingList :: [Key PackageName] -> Encoding Source #
FromJSON (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods parseJSON :: Value -> Parser (Key PackageName) Source # parseJSONList :: Value -> Parser [Key PackageName] Source #
PersistFieldSql (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods sqlType :: Proxy (Key PackageName) -> SqlType Source #
PersistField (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods toPersistValue :: Key PackageName -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text (Key PackageName) Source #
FromHttpApiData (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods parseUrlPiece :: Text -> Either Text (Key PackageName) parseHeader :: ByteString -> Either Text (Key PackageName) parseQueryParam :: Text -> Either Text (Key PackageName)
ToHttpApiData (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods toUrlPiece :: Key PackageName -> Text toEncodedUrlPiece :: Key PackageName -> Builder toHeader :: Key PackageName -> ByteString toQueryParam :: Key PackageName -> Text
PathPiece (Key PackageName) Source # |
Instance details Defined in Pantry.Storage Methods fromPathPiece :: Text -> Maybe (Key PackageName) toPathPiece :: Key PackageName -> Text
data Unique PackageName Source # |
Instance details Defined in Pantry.Storage data Unique PackageName = UniquePackageName PackageNameP
data EntityField PackageName typ Source # |

Instance details

Defined in Pantry.Storage

data EntityField PackageName typ

- = typ ~ Key PackageName => PackageNameId
- | typ ~ PackageNameP => PackageNameName

newtype Key PackageName Source # |

Instance details

Defined in Pantry.Storage

newtype Key PackageName = PackageNameKey {

- unPackageNameKey :: BackendKey SqlBackend

}

type PersistEntityBackend PackageName Source # |
Instance details Defined in Pantry.Storage type PersistEntityBackend PackageName = SqlBackend

type BlobId = Key Blob Source #

migrateAll :: Migration Source #

getPackageNameById :: PackageNameId -> ReaderT SqlBackend (RIO env) (Maybe PackageName) Source #

getPackageNameId :: PackageName -> ReaderT SqlBackend (RIO env) PackageNameId Source #

getVersionId :: Version -> ReaderT SqlBackend (RIO env) VersionId Source #

storeBlob :: ByteString -> ReaderT SqlBackend (RIO env) (BlobId, BlobKey) Source #

loadBlobById :: BlobId -> ReaderT SqlBackend (RIO env) ByteString Source #

getBlobKey :: BlobId -> ReaderT SqlBackend (RIO env) BlobKey Source #

getTreeForKey :: TreeKey -> ReaderT SqlBackend (RIO env) (Maybe (Entity Tree)) Source #

data HackageTarballResult Source #

Information returned by `getHackageTarball`

Since: 0.1.0.0

Constructors

HackageTarballResult |

Fields

- htrPackage :: !Package

  Package that was loaded from Hackage tarball

- htrFreshPackageInfo :: !(Maybe (GenericPackageDescription, TreeId))

  This information is only available whenever package was just loaded into pantry.

forceUpdateHackageIndex :: (HasPantryConfig env, HasLogFunc env) => Maybe Utf8Builder -> RIO env DidUpdateOccur Source #

Same as `updateHackageIndex`, but force the database update even if hackage security tells that there is no change. This can be useful in order to make sure the database is in sync with the locally downloaded tarball

Since: 0.1.0.0

getHackageTarball :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageIdentifierRevision -> Maybe TreeKey -> RIO env HackageTarballResult Source #