Safe Haskell | Safe-Inferred |
---|---|
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 and some are needed for stack testing.
Synopsis
- data family Key record
- data PackageName
- data Version
- data Tree = Tree {
- treeKey :: !BlobId
- treeCabal :: !(Maybe BlobId)
- treeCabalType :: !FileType
- treeName :: !PackageNameId
- treeVersion :: !VersionId
- data SafeFilePath
- newtype ModuleNameP = ModuleNameP {}
- newtype VersionP = VersionP {}
- newtype PackageNameP = PackageNameP {}
- data PantryConfig = PantryConfig {
- pcPackageIndex :: !PackageIndexConfig
- 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
- pcCasaConfig :: !(Maybe (CasaRepoPrefix, Int))
- pcSnapshotLocation :: SnapName -> RawSnapshotLocation
- 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
- data HackageTarballResult = HackageTarballResult {
- htrPackage :: !Package
- htrFreshPackageInfo :: !(Maybe (GenericPackageDescription, TreeId))
- type BlobId = Key Blob
- data family EntityField record :: Type -> Type
- type HackageCabalId = Key HackageCabal
- type ModuleNameId = Key ModuleName
- type PackageNameId = Key PackageName
- type TreeEntryId = Key TreeEntry
- type TreeId = Key Tree
- data family Unique record
- type VersionId = Key Version
- packageTreeKey :: Package -> TreeKey
- unSafeFilePath :: SafeFilePath -> Text
- mkSafeFilePath :: Text -> Maybe SafeFilePath
- getHackageTarball :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageIdentifierRevision -> Maybe TreeKey -> RIO env HackageTarballResult
- getTreeForKey :: TreeKey -> ReaderT SqlBackend (RIO env) (Maybe (Entity Tree))
- forceUpdateHackageIndex :: (HasPantryConfig env, HasLogFunc env) => Maybe Utf8Builder -> RIO env DidUpdateOccur
- allBlobsCount :: Maybe BlobId -> ReaderT SqlBackend (RIO env) Int
- allBlobsSource :: HasResourceMap env => Maybe BlobId -> ConduitT () (BlobId, ByteString) (ReaderT SqlBackend (RIO env)) ()
- allHackageCabalCount :: Maybe HackageCabalId -> ReaderT SqlBackend (RIO env) Int
- allHackageCabalRawPackageLocations :: HasResourceMap env => Maybe HackageCabalId -> ReaderT SqlBackend (RIO env) (Map HackageCabalId RawPackageLocationImmutable)
- getBlobKey :: BlobId -> ReaderT SqlBackend (RIO env) BlobKey
- getPackageNameById :: PackageNameId -> ReaderT SqlBackend (RIO env) (Maybe PackageName)
- getPackageNameId :: PackageName -> ReaderT SqlBackend (RIO env) PackageNameId
- getVersionId :: Version -> ReaderT SqlBackend (RIO env) VersionId
- loadBlobById :: BlobId -> ReaderT SqlBackend (RIO env) ByteString
- migrateAll :: Migration
- storeBlob :: ByteString -> ReaderT SqlBackend (RIO env) (BlobId, BlobKey)
Documentation
Instances
data PackageName Source #
Instances
Instances
PersistEntity Version Source # | |
Defined in Pantry.Storage Methods keyToValues :: Key Version -> [PersistValue] keyFromValues :: [PersistValue] -> Either Text (Key Version) persistIdField :: EntityField Version (Key Version) entityDef :: proxy Version -> EntityDef persistFieldDef :: EntityField Version typ -> FieldDef toPersistFields :: Version -> [PersistValue] fromPersistValues :: [PersistValue] -> Either Text Version tabulateEntityA :: Applicative f => (forall a. EntityField Version a -> f a) -> f (Entity Version) persistUniqueKeys :: Version -> [Unique Version] persistUniqueToFieldNames :: Unique Version -> NonEmpty (FieldNameHS, FieldNameDB) persistUniqueToValues :: Unique Version -> [PersistValue] fieldLens :: EntityField Version field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity Version -> f (Entity Version) keyFromRecordM :: Maybe (Version -> Key Version) | |
SafeToInsert Version Source # | |
Defined in Pantry.Storage | |
PersistField Version Source # | |
Defined in Pantry.Storage Methods toPersistValue :: Version -> PersistValue fromPersistValue :: PersistValue -> Either Text Version | |
AtLeastOneUniqueKey Version Source # | |
Defined in Pantry.Storage Methods requireUniquesP :: Version -> NonEmpty (Unique Version) | |
OnlyOneUniqueKey Version Source # | |
Defined in Pantry.Storage Methods onlyUniqueP :: Version -> Unique Version | |
PersistFieldSql Version Source # | |
Defined in Pantry.Storage | |
ToBackendKey SqlBackend Version Source # | |
Defined in Pantry.Storage Methods toBackendKey :: Key Version -> BackendKey SqlBackend fromBackendKey :: BackendKey SqlBackend -> Key Version | |
SymbolToField "version" Tree VersionId Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "version" Version VersionP Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "id" Version (Key Version) Source # | |
Defined in Pantry.Storage Methods | |
FromJSON (Key Version) Source # | |
Defined in Pantry.Storage | |
ToJSON (Key Version) Source # | |
Defined in Pantry.Storage Methods toJSON :: Key Version -> Value toEncoding :: Key Version -> Encoding toJSONList :: [Key Version] -> Value toEncodingList :: [Key Version] -> Encoding | |
Read (Key Version) Source # | |
Show (Key Version) Source # | |
Eq (Key Version) Source # | |
Ord (Key Version) Source # | |
FromHttpApiData (Key Version) Source # | |
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 # | |
Defined in Pantry.Storage Methods toUrlPiece :: Key Version -> Text toEncodedUrlPiece :: Key Version -> Builder toHeader :: Key Version -> ByteString toQueryParam :: Key Version -> Text toEncodedQueryParam :: Key Version -> Builder | |
PathPiece (Key Version) Source # | |
Defined in Pantry.Storage | |
PersistField (Key Version) Source # | |
Defined in Pantry.Storage Methods toPersistValue :: Key Version -> PersistValue fromPersistValue :: PersistValue -> Either Text (Key Version) | |
PersistFieldSql (Key Version) Source # | |
Defined in Pantry.Storage | |
data EntityField Version typ Source # | |
Defined in Pantry.Storage | |
newtype Key Version Source # | |
Defined in Pantry.Storage | |
type PersistEntityBackend Version Source # | |
Defined in Pantry.Storage type PersistEntityBackend Version = SqlBackend | |
data Unique Version Source # | |
Defined in Pantry.Storage |
Constructors
Tree | |
Fields
|
Instances
PersistEntity Tree Source # | |
Defined in Pantry.Storage Methods keyToValues :: Key Tree -> [PersistValue] keyFromValues :: [PersistValue] -> Either Text (Key Tree) persistIdField :: EntityField Tree (Key Tree) entityDef :: proxy Tree -> EntityDef persistFieldDef :: EntityField Tree typ -> FieldDef toPersistFields :: Tree -> [PersistValue] fromPersistValues :: [PersistValue] -> Either Text Tree tabulateEntityA :: Applicative f => (forall a. EntityField Tree a -> f a) -> f (Entity Tree) persistUniqueKeys :: Tree -> [Unique Tree] persistUniqueToFieldNames :: Unique Tree -> NonEmpty (FieldNameHS, FieldNameDB) persistUniqueToValues :: Unique Tree -> [PersistValue] fieldLens :: EntityField Tree field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity Tree -> f (Entity Tree) keyFromRecordM :: Maybe (Tree -> Key Tree) | |
SafeToInsert Tree Source # | |
Defined in Pantry.Storage | |
PersistField Tree Source # | |
Defined in Pantry.Storage | |
AtLeastOneUniqueKey Tree Source # | |
Defined in Pantry.Storage Methods requireUniquesP :: Tree -> NonEmpty (Unique Tree) | |
OnlyOneUniqueKey Tree Source # | |
Defined in Pantry.Storage Methods onlyUniqueP :: Tree -> Unique Tree | |
PersistFieldSql Tree Source # | |
Defined in Pantry.Storage | |
ToBackendKey SqlBackend Tree Source # | |
Defined in Pantry.Storage Methods toBackendKey :: Key Tree -> BackendKey SqlBackend fromBackendKey :: BackendKey SqlBackend -> Key Tree | |
SymbolToField "cabalType" Tree FileType Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "key" Tree BlobId Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "name" Tree PackageNameId Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "version" Tree VersionId Source # | |
Defined in Pantry.Storage Methods | |
SymbolToField "cabal" Tree (Maybe BlobId) Source # | |
Defined in Pantry.Storage Methods symbolToField :: EntityField Tree (Maybe BlobId) | |
SymbolToField "id" Tree (Key Tree) Source # | |
Defined in Pantry.Storage Methods symbolToField :: EntityField Tree (Key Tree) | |
FromJSON (Key Tree) Source # | |
Defined in Pantry.Storage | |
ToJSON (Key Tree) Source # | |
Defined in Pantry.Storage Methods toEncoding :: Key Tree -> Encoding toJSONList :: [Key Tree] -> Value toEncodingList :: [Key Tree] -> Encoding | |
Read (Key Tree) Source # | |
Show (Key Tree) Source # | |
Eq (Key Tree) Source # | |
Ord (Key Tree) Source # | |
FromHttpApiData (Key Tree) Source # | |
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 # | |
Defined in Pantry.Storage Methods toUrlPiece :: Key Tree -> Text toEncodedUrlPiece :: Key Tree -> Builder toHeader :: Key Tree -> ByteString toQueryParam :: Key Tree -> Text toEncodedQueryParam :: Key Tree -> Builder | |
PathPiece (Key Tree) Source # | |
Defined in Pantry.Storage | |
PersistField (Key Tree) Source # | |
Defined in Pantry.Storage Methods toPersistValue :: Key Tree -> PersistValue fromPersistValue :: PersistValue -> Either Text (Key Tree) | |
PersistFieldSql (Key Tree) Source # | |
Defined in Pantry.Storage | |
data EntityField Tree typ Source # | |
Defined in Pantry.Storage data EntityField Tree typ
| |
newtype Key Tree Source # | |
Defined in Pantry.Storage | |
type PersistEntityBackend Tree Source # | |
Defined in Pantry.Storage type PersistEntityBackend Tree = SqlBackend | |
data Unique Tree Source # | |
Defined in Pantry.Storage |
data SafeFilePath Source #
Instances
Show SafeFilePath | |
Defined in Pantry.Types Methods showsPrec :: Int -> SafeFilePath -> ShowS show :: SafeFilePath -> String showList :: [SafeFilePath] -> ShowS | |
Eq SafeFilePath | |
Defined in Pantry.Types | |
Ord SafeFilePath | |
Defined in Pantry.Types Methods compare :: SafeFilePath -> SafeFilePath -> Ordering (<) :: SafeFilePath -> SafeFilePath -> Bool (<=) :: SafeFilePath -> SafeFilePath -> Bool (>) :: SafeFilePath -> SafeFilePath -> Bool (>=) :: SafeFilePath -> SafeFilePath -> Bool max :: SafeFilePath -> SafeFilePath -> SafeFilePath min :: SafeFilePath -> SafeFilePath -> SafeFilePath | |
PersistField SafeFilePath | |
Defined in Pantry.Types Methods toPersistValue :: SafeFilePath -> PersistValue fromPersistValue :: PersistValue -> Either Text SafeFilePath | |
PersistFieldSql SafeFilePath | |
Defined in Pantry.Types Methods sqlType :: Proxy SafeFilePath -> SqlType | |
Display SafeFilePath | |
Defined in Pantry.Types |
newtype ModuleNameP Source #
Constructors
ModuleNameP | |
Fields |
Instances
Show ModuleNameP | |
Defined in Pantry.Types Methods showsPrec :: Int -> ModuleNameP -> ShowS show :: ModuleNameP -> String showList :: [ModuleNameP] -> ShowS | |
NFData ModuleNameP | |
Defined in Pantry.Types Methods rnf :: ModuleNameP -> () | |
Eq ModuleNameP | |
Defined in Pantry.Types | |
Ord ModuleNameP | |
Defined in Pantry.Types Methods compare :: ModuleNameP -> ModuleNameP -> Ordering (<) :: ModuleNameP -> ModuleNameP -> Bool (<=) :: ModuleNameP -> ModuleNameP -> Bool (>) :: ModuleNameP -> ModuleNameP -> Bool (>=) :: ModuleNameP -> ModuleNameP -> Bool max :: ModuleNameP -> ModuleNameP -> ModuleNameP min :: ModuleNameP -> ModuleNameP -> ModuleNameP | |
PersistField ModuleNameP | |
Defined in Pantry.Types Methods toPersistValue :: ModuleNameP -> PersistValue fromPersistValue :: PersistValue -> Either Text ModuleNameP | |
PersistFieldSql ModuleNameP | |
Defined in Pantry.Types Methods sqlType :: Proxy ModuleNameP -> SqlType | |
Display ModuleNameP | |
Defined in Pantry.Types |
Constructors
VersionP | |
Fields |
Instances
FromJSON VersionP | |
Defined in Pantry.Types | |
ToJSON VersionP | |
Defined in Pantry.Types Methods toEncoding :: VersionP -> Encoding toJSONList :: [VersionP] -> Value toEncodingList :: [VersionP] -> Encoding | |
Read VersionP | |
Defined in Pantry.Types | |
Show VersionP | |
NFData VersionP | |
Defined in Pantry.Types | |
Eq VersionP | |
Ord VersionP | |
PersistField VersionP | |
Defined in Pantry.Types Methods toPersistValue :: VersionP -> PersistValue fromPersistValue :: PersistValue -> Either Text VersionP | |
PersistFieldSql VersionP | |
Defined in Pantry.Types | |
Display VersionP | |
Defined in Pantry.Types | |
SymbolToField "version" Version VersionP | |
Defined in Pantry.Storage Methods |
newtype PackageNameP Source #
Constructors
PackageNameP | |
Fields |
Instances
data PantryConfig Source #
Configuration value used by the entire pantry package. Create one using
withPantryConfig
or withPantryConfig'
. See also PantryApp
for a
convenience approach to using pantry.
Since: 0.1.0.0
Constructors
PantryConfig | |
Fields
|
Represents a SQL database connection.
Constructors
Storage | |
Fields
|
data HackageTarballResult Source #
Information returned by getHackageTarball
Since: 0.1.0.0
Constructors
HackageTarballResult | |
Fields
|
data family EntityField record :: Type -> Type #
Instances
SymbolToField sym rec typ => IsLabel sym (EntityField rec typ) | |
Defined in Database.Persist.Class.PersistEntity Methods fromLabel :: EntityField rec typ | |
data EntityField PackageName typ Source # | |
Defined in Pantry.Storage data EntityField PackageName typ
| |
data EntityField Tree typ Source # | |
Defined in Pantry.Storage data EntityField Tree typ
| |
data EntityField Version typ Source # | |
Defined in Pantry.Storage |
type HackageCabalId = Key HackageCabal Source #
type ModuleNameId = Key ModuleName Source #
type PackageNameId = Key PackageName Source #
type TreeEntryId = Key TreeEntry Source #
Instances
data Unique PackageName Source # | |
Defined in Pantry.Storage | |
data Unique Tree Source # | |
Defined in Pantry.Storage | |
data Unique Version Source # | |
Defined in Pantry.Storage |
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 #
getHackageTarball :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageIdentifierRevision -> Maybe TreeKey -> RIO env HackageTarballResult Source #
getTreeForKey :: TreeKey -> ReaderT SqlBackend (RIO env) (Maybe (Entity Tree)) Source #
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
allBlobsCount :: Maybe BlobId -> ReaderT SqlBackend (RIO env) Int Source #
Arguments
:: HasResourceMap env | |
=> Maybe BlobId | For some x, yield blob whose id>x. |
-> ConduitT () (BlobId, ByteString) (ReaderT SqlBackend (RIO env)) () |
allHackageCabalCount :: Maybe HackageCabalId -> ReaderT SqlBackend (RIO env) Int Source #
allHackageCabalRawPackageLocations Source #
Arguments
:: HasResourceMap env | |
=> Maybe HackageCabalId | For some x, yield cabals whose id>x. |
-> ReaderT SqlBackend (RIO env) (Map HackageCabalId RawPackageLocationImmutable) |
Pull all hackage cabal entries from the database as
RawPackageLocationImmutable
. We do a manual join rather than dropping to
raw SQL, and Esqueleto would add more deps.
getBlobKey :: BlobId -> ReaderT SqlBackend (RIO env) BlobKey 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 #
loadBlobById :: BlobId -> ReaderT SqlBackend (RIO env) ByteString Source #
migrateAll :: Migration Source #