Skip to content

Commit

Permalink
Merge pull request #99 from commercialhaskell/fix98
Browse files Browse the repository at this point in the history
Fix #98 Expose Pantry.SQLite
  • Loading branch information
mpilgrem authored Jul 16, 2023
2 parents 9de05d0 + 9394c3f commit ab2eb91
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for pantry

## v0.9.1

* Expose module `Pantry.SQLite`.

## v0.9.0

* Remove module `Pantry.Internal.AesonExtended` and depend on
Expand Down
13 changes: 7 additions & 6 deletions int/Pantry/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,13 @@ cabalFileName name =
newtype Revision = Revision Word
deriving (Generic, Show, Eq, NFData, Data, Typeable, Ord, Hashable, Display, PersistField, PersistFieldSql)

-- | 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.
-- | 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.
data Storage = Storage
{ withStorage_ ::
forall env a. HasLogFunc env
Expand Down
5 changes: 3 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pantry
version: 0.9.0
version: 0.9.1
synopsis: Content addressable Haskell package management
description: Please see the README on GitHub at <https://github.com/commercialhaskell/pantry#readme>
category: Development
Expand Down Expand Up @@ -99,8 +99,9 @@ library:

exposed-modules:
- Pantry
- Pantry.SQLite

# For stackage-server
# For stackage-server, and stack testing
- Pantry.Internal.Stackage

reexported-modules:
Expand Down
4 changes: 2 additions & 2 deletions pantry.cabal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Pantry/Internal/Stackage.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- | All types and functions exported from this module are for advanced usage
-- only. They are needed for stackage-server integration with pantry.
-- only. They are needed for stackage-server integration with pantry and some
-- are needed for stack testing.
module Pantry.Internal.Stackage
( module X
) where
Expand Down
10 changes: 5 additions & 5 deletions int/Pantry/SQLite.hs → src/Pantry/SQLite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import System.FileLock

initStorage ::
HasLogFunc env
=> Text
-> Migration
-> Path Abs File -- ^ storage file
-> (Storage -> RIO env a)
=> Text -- ^ Database description, for lock messages.
-> Migration -- ^ Initial migration.
-> Path Abs File -- ^ SQLite database file.
-> (Storage -> RIO env a) -- ^ What to do with the initialised 'Storage'.
-> RIO env a
initStorage description migration fp inner = do
ensureDir $ parent fp
Expand Down Expand Up @@ -76,7 +76,7 @@ initStorage description migration fp inner = do
-- above.
withWriteLock ::
HasLogFunc env
=> Utf8Builder -- ^ database description, for lock messages
=> Utf8Builder -- ^ Database description, for lock messages
-> Path Abs File -- ^ SQLite database file
-> RIO env a
-> RIO env a
Expand Down

0 comments on commit ab2eb91

Please sign in to comment.