pantry-0.4.0.2: Content addressable Haskell package management

Safe Haskell | None
Language | Haskell2010

Pantry.Internal

Description

Exposed for testing, do not use!

Synopsis

- parseTree :: ByteString -> Maybe Tree
- renderTree :: Tree -> ByteString
- newtype Tree = TreeMap (Map SafeFilePath TreeEntry)
- data TreeEntry = TreeEntry {
  - teBlob :: !BlobKey
  - teType :: !FileType
  }
- data FileType
  - = FTNormal
  - | FTExecutable
- mkSafeFilePath :: Text -> Maybe SafeFilePath
- pcHpackExecutable :: PantryConfig -> HpackExecutable
- normalizeParents :: FilePath -> Either String FilePath
- makeTarRelative :: FilePath -> FilePath -> Either String FilePath
- getGlobalHintsFile :: HasPantryConfig env => RIO env (Path Abs File)
- hpackVersion :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RIO env Version
- data Storage
- initStorage :: HasLogFunc env => Text -> Migration -> Path Abs File -> (Storage -> RIO env a) -> RIO env a
- withStorage_ :: Storage -> forall env a. HasLogFunc env => ReaderT SqlBackend (RIO env) a -> RIO env a

# Documentation

parseTree :: ByteString -> Maybe Tree Source #

renderTree :: Tree -> ByteString Source #

newtype Tree Source #

Represents the contents of a tree, which is a mapping from relative file paths to `TreeEntry`s.

Since: 0.1.0.0

Constructors

TreeMap (Map SafeFilePath TreeEntry) |

#### Instances

Instances details

Eq Tree Source # |
Instance details Defined in Pantry.Types Methods (==) :: Tree -> Tree -> Bool Source # (/=) :: Tree -> Tree -> Bool Source #
Show Tree Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> Tree -> ShowS Source # show :: Tree -> String Source # showList :: [Tree] -> ShowS Source #

data TreeEntry Source #

Constructors

TreeEntry |

Fields

- teBlob :: !BlobKey
- teType :: !FileType

#### Instances

Instances details

Eq TreeEntry Source # |
Instance details Defined in Pantry.Types Methods (==) :: TreeEntry -> TreeEntry -> Bool Source # (/=) :: TreeEntry -> TreeEntry -> Bool Source #
Show TreeEntry Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> TreeEntry -> ShowS Source # show :: TreeEntry -> String Source # showList :: [TreeEntry] -> ShowS Source #

data FileType Source #

Constructors

FTNormal |
FTExecutable |

#### Instances

Instances details

Bounded FileType Source # |
Instance details Defined in Pantry.Types Methods minBound :: FileType Source # maxBound :: FileType Source #
Enum FileType Source # |

Instance details

Defined in Pantry.Types

Methods

succ :: FileType -> FileType Source #

pred :: FileType -> FileType Source #

toEnum :: Int -> FileType Source #

fromEnum :: FileType -> Int Source #

enumFrom :: FileType -> [FileType] Source #

enumFromThen :: FileType -> FileType -> [FileType] Source #

enumFromTo :: FileType -> FileType -> [FileType] Source #

enumFromThenTo :: FileType -> FileType -> FileType -> [FileType] Source #

Eq FileType Source # |
Instance details Defined in Pantry.Types Methods (==) :: FileType -> FileType -> Bool Source # (/=) :: FileType -> FileType -> Bool Source #
Show FileType Source # |
Instance details Defined in Pantry.Types Methods showsPrec :: Int -> FileType -> ShowS Source # show :: FileType -> String Source # showList :: [FileType] -> ShowS Source #
PersistFieldSql FileType Source # |
Instance details Defined in Pantry.Types Methods sqlType :: Proxy FileType -> SqlType Source #
PersistField FileType Source # |
Instance details Defined in Pantry.Types Methods toPersistValue :: FileType -> PersistValue Source # fromPersistValue :: PersistValue -> Either Text FileType Source #

mkSafeFilePath :: Text -> Maybe SafeFilePath Source #

pcHpackExecutable :: PantryConfig -> HpackExecutable Source #

normalizeParents :: FilePath -> Either String FilePath Source #

Like `System.FilePath.normalise`, however:

- Only works on relative paths, absolute paths fail
- Strips trailing slashes
- Only works on forward slashes, even on Windows
- Normalizes parent dirs `foo..` get stripped
- Cannot begin with a parent directory (`../`)
- Spelled like an American, sorry

makeTarRelative Source #

Arguments

:: FilePath | base file
-> FilePath | relative part
-> Either String FilePath |

Following tar file rules (Unix file paths only), make the second file relative to the first file.

getGlobalHintsFile :: HasPantryConfig env => RIO env (Path Abs File) Source #

Get the path to the global hints cache file

hpackVersion :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RIO env Version Source #

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.

initStorage Source #

Arguments

:: HasLogFunc env |
=> Text |
-> Migration |
-> Path Abs File | storage file
-> (Storage -> RIO env a) |
-> RIO env a |

withStorage_ :: Storage -> forall env a. HasLogFunc env => ReaderT SqlBackend (RIO env) a -> RIO env a Source #