updated: lts to 15
This commit is contained in:
parent
130fbbaaf2
commit
fc77ca238e
@ -10,12 +10,12 @@ dist: trusty
|
|||||||
language: c
|
language: c
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libgmp-dev
|
- libgmp-dev
|
||||||
postgresql: "9.3"
|
postgresql: "9.3"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
@ -25,8 +25,7 @@ cache:
|
|||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: STACKARGS="--resolver=lts-11"
|
- env: STACKARGS="--resolver=lts-15"
|
||||||
- env: STACKARGS="--resolver=lts-12"
|
|
||||||
- env: STACKARGS="--resolver=nightly"
|
- env: STACKARGS="--resolver=nightly"
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: STACKARGS="--resolver=nightly"
|
- env: STACKARGS="--resolver=nightly"
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
{-# LANGUAGE DerivingStrategies #-}
|
||||||
|
{-# LANGUAGE StandaloneDeriving #-}
|
||||||
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
module Model where
|
module Model where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|||||||
@ -109,14 +109,14 @@ instance SafeCopy SS.SessionMap where
|
|||||||
|
|
||||||
-- | We can't @deriveSafeCopy 0 'base ''SS.SessionId@ as
|
-- | We can't @deriveSafeCopy 0 'base ''SS.SessionId@ as
|
||||||
-- otherwise we'd require an unneeded @SafeCopy sess@.
|
-- otherwise we'd require an unneeded @SafeCopy sess@.
|
||||||
instance SafeCopy (SS.SessionId sess) where
|
instance Typeable sess => SafeCopy (SS.SessionId sess) where
|
||||||
putCopy = contain . safePut . SSI.unS
|
putCopy = contain . safePut . SSI.unS
|
||||||
getCopy = contain $ SSI.S <$> safeGet
|
getCopy = contain $ SSI.S <$> safeGet
|
||||||
|
|
||||||
|
|
||||||
-- | We can't @deriveSafeCopy 0 'base ''SS.Session@ due to the
|
-- | We can't @deriveSafeCopy 0 'base ''SS.Session@ due to the
|
||||||
-- required context.
|
-- required context.
|
||||||
instance SafeCopy (SS.Decomposed sess) => SafeCopy (SS.Session sess) where
|
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (SS.Session sess) where
|
||||||
putCopy (SS.Session key authId data_ createdAt accessedAt) = contain $ do
|
putCopy (SS.Session key authId data_ createdAt accessedAt) = contain $ do
|
||||||
put_t <- getSafePut
|
put_t <- getSafePut
|
||||||
safePut key
|
safePut key
|
||||||
@ -136,7 +136,7 @@ instance SafeCopy (SS.Decomposed sess) => SafeCopy (SS.Session sess) where
|
|||||||
|
|
||||||
-- | We can't @deriveSafeCopy 0 'base ''ServerSessionAcidState@ due
|
-- | We can't @deriveSafeCopy 0 'base ''ServerSessionAcidState@ due
|
||||||
-- to the required context.
|
-- to the required context.
|
||||||
instance SafeCopy (SS.Decomposed sess) => SafeCopy (ServerSessionAcidState sess) where
|
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (ServerSessionAcidState sess) where
|
||||||
putCopy (ServerSessionAcidState sits aits) = contain $ do
|
putCopy (ServerSessionAcidState sits aits) = contain $ do
|
||||||
safePut (HM.toList sits)
|
safePut (HM.toList sits)
|
||||||
safePut (HM.toList aits)
|
safePut (HM.toList aits)
|
||||||
@ -273,23 +273,23 @@ data DeleteAllSessionsOfAuthId sess = DeleteAllSessionsOfAuthId SS.AuthId derivi
|
|||||||
data InsertSession sess = InsertSession (SS.Session sess) deriving (Typeable)
|
data InsertSession sess = InsertSession (SS.Session sess) deriving (Typeable)
|
||||||
data ReplaceSession sess = ReplaceSession (SS.Session sess) deriving (Typeable)
|
data ReplaceSession sess = ReplaceSession (SS.Session sess) deriving (Typeable)
|
||||||
|
|
||||||
instance SafeCopy (GetSession sess) where
|
instance Typeable sess => SafeCopy (GetSession sess) where
|
||||||
putCopy (GetSession v) = contain $ safePut v
|
putCopy (GetSession v) = contain $ safePut v
|
||||||
getCopy = contain $ GetSession <$> safeGet
|
getCopy = contain $ GetSession <$> safeGet
|
||||||
|
|
||||||
instance SafeCopy (DeleteSession sess) where
|
instance Typeable sess => SafeCopy (DeleteSession sess) where
|
||||||
putCopy (DeleteSession v) = contain $ safePut v
|
putCopy (DeleteSession v) = contain $ safePut v
|
||||||
getCopy = contain $ DeleteSession <$> safeGet
|
getCopy = contain $ DeleteSession <$> safeGet
|
||||||
|
|
||||||
instance SafeCopy (DeleteAllSessionsOfAuthId sess) where
|
instance Typeable sess => SafeCopy (DeleteAllSessionsOfAuthId sess) where
|
||||||
putCopy (DeleteAllSessionsOfAuthId v) = contain $ safePut v
|
putCopy (DeleteAllSessionsOfAuthId v) = contain $ safePut v
|
||||||
getCopy = contain $ DeleteAllSessionsOfAuthId <$> safeGet
|
getCopy = contain $ DeleteAllSessionsOfAuthId <$> safeGet
|
||||||
|
|
||||||
instance SafeCopy (SS.Decomposed sess) => SafeCopy (InsertSession sess) where
|
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (InsertSession sess) where
|
||||||
putCopy (InsertSession v) = contain $ safePut v
|
putCopy (InsertSession v) = contain $ safePut v
|
||||||
getCopy = contain $ InsertSession <$> safeGet
|
getCopy = contain $ InsertSession <$> safeGet
|
||||||
|
|
||||||
instance SafeCopy (SS.Decomposed sess) => SafeCopy (ReplaceSession sess) where
|
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (ReplaceSession sess) where
|
||||||
putCopy (ReplaceSession v) = contain $ safePut v
|
putCopy (ReplaceSession v) = contain $ safePut v
|
||||||
getCopy = contain $ ReplaceSession <$> safeGet
|
getCopy = contain $ ReplaceSession <$> safeGet
|
||||||
|
|
||||||
@ -322,8 +322,8 @@ instance AcidContext sess => Method (ReplaceSession sess) where
|
|||||||
|
|
||||||
instance AcidContext sess => IsAcidic (ServerSessionAcidState sess) where
|
instance AcidContext sess => IsAcidic (ServerSessionAcidState sess) where
|
||||||
acidEvents =
|
acidEvents =
|
||||||
[ QueryEvent $ \(GetSession sid) -> getSession sid
|
[ QueryEvent (\(GetSession sid) -> getSession sid) safeCopyMethodSerialiser
|
||||||
, UpdateEvent $ \(DeleteSession sid) -> deleteSession sid
|
, UpdateEvent (\(DeleteSession sid) -> deleteSession sid) safeCopyMethodSerialiser
|
||||||
, UpdateEvent $ \(DeleteAllSessionsOfAuthId authId) -> deleteAllSessionsOfAuthId authId
|
, UpdateEvent (\(DeleteAllSessionsOfAuthId authId) -> deleteAllSessionsOfAuthId authId) safeCopyMethodSerialiser
|
||||||
, UpdateEvent $ \(InsertSession session) -> insertSession session
|
, UpdateEvent (\(InsertSession session) -> insertSession session) safeCopyMethodSerialiser
|
||||||
, UpdateEvent $ \(ReplaceSession session) -> replaceSession session ]
|
, UpdateEvent (\(ReplaceSession session) -> replaceSession session) safeCopyMethodSerialiser ]
|
||||||
|
|||||||
@ -96,6 +96,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
["Eq", "Ord", "Show", "Typeable"]
|
["Eq", "Ord", "Show", "Typeable"]
|
||||||
M.mempty
|
M.mempty
|
||||||
False
|
False
|
||||||
|
Nothing
|
||||||
where
|
where
|
||||||
pfd :: P.EntityField (PersistentSession sess) typ -> P.FieldDef
|
pfd :: P.EntityField (PersistentSession sess) typ -> P.FieldDef
|
||||||
pfd = P.persistFieldDef
|
pfd = P.persistFieldDef
|
||||||
@ -142,8 +143,10 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
(P.SqlOther "SqlType unset for key")
|
(P.SqlOther "SqlType unset for key")
|
||||||
[]
|
[]
|
||||||
True
|
True
|
||||||
P.NoReference]
|
P.NoReference
|
||||||
|
Nothing]
|
||||||
[]))
|
[]))
|
||||||
|
Nothing
|
||||||
persistFieldDef PersistentSessionKey
|
persistFieldDef PersistentSessionKey
|
||||||
= P.FieldDef
|
= P.FieldDef
|
||||||
(P.HaskellName "key")
|
(P.HaskellName "key")
|
||||||
@ -153,6 +156,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
["maxlen=30"]
|
["maxlen=30"]
|
||||||
True
|
True
|
||||||
P.NoReference
|
P.NoReference
|
||||||
|
Nothing
|
||||||
persistFieldDef PersistentSessionAuthId
|
persistFieldDef PersistentSessionAuthId
|
||||||
= P.FieldDef
|
= P.FieldDef
|
||||||
(P.HaskellName "authId")
|
(P.HaskellName "authId")
|
||||||
@ -162,6 +166,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
["Maybe", "default=NULL"]
|
["Maybe", "default=NULL"]
|
||||||
True
|
True
|
||||||
P.NoReference
|
P.NoReference
|
||||||
|
Nothing
|
||||||
persistFieldDef PersistentSessionSession
|
persistFieldDef PersistentSessionSession
|
||||||
= P.FieldDef
|
= P.FieldDef
|
||||||
(P.HaskellName "session")
|
(P.HaskellName "session")
|
||||||
@ -171,6 +176,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
[]
|
[]
|
||||||
True
|
True
|
||||||
P.NoReference
|
P.NoReference
|
||||||
|
Nothing
|
||||||
persistFieldDef PersistentSessionCreatedAt
|
persistFieldDef PersistentSessionCreatedAt
|
||||||
= P.FieldDef
|
= P.FieldDef
|
||||||
(P.HaskellName "createdAt")
|
(P.HaskellName "createdAt")
|
||||||
@ -180,6 +186,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
[]
|
[]
|
||||||
True
|
True
|
||||||
P.NoReference
|
P.NoReference
|
||||||
|
Nothing
|
||||||
persistFieldDef PersistentSessionAccessedAt
|
persistFieldDef PersistentSessionAccessedAt
|
||||||
= P.FieldDef
|
= P.FieldDef
|
||||||
(P.HaskellName "accessedAt")
|
(P.HaskellName "accessedAt")
|
||||||
@ -189,6 +196,7 @@ instance forall sess. P.PersistFieldSql (Decomposed sess) => P.PersistEntity (Pe
|
|||||||
[]
|
[]
|
||||||
True
|
True
|
||||||
P.NoReference
|
P.NoReference
|
||||||
|
Nothing
|
||||||
|
|
||||||
persistIdField = PersistentSessionId
|
persistIdField = PersistentSessionId
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ library
|
|||||||
build-depends:
|
build-depends:
|
||||||
base == 4.*
|
base == 4.*
|
||||||
, bytestring
|
, bytestring
|
||||||
, hedis < 0.11
|
, hedis < 0.13
|
||||||
, path-pieces
|
, path-pieces
|
||||||
, tagged >= 0.7
|
, tagged >= 0.7
|
||||||
, text
|
, text
|
||||||
|
|||||||
@ -29,6 +29,7 @@ library
|
|||||||
, hashable
|
, hashable
|
||||||
, nonce == 1.0.*
|
, nonce == 1.0.*
|
||||||
, path-pieces
|
, path-pieces
|
||||||
|
, persistent-test
|
||||||
, text
|
, text
|
||||||
, time
|
, time
|
||||||
, transformers
|
, transformers
|
||||||
|
|||||||
@ -10,6 +10,7 @@ module Web.ServerSession.Core.StorageTests
|
|||||||
import Control.Applicative as A
|
import Control.Applicative as A
|
||||||
import Control.Exception (Exception)
|
import Control.Exception (Exception)
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import DataTypeTest (roundUTCTime)
|
||||||
import Web.ServerSession.Core.Internal
|
import Web.ServerSession.Core.Internal
|
||||||
|
|
||||||
import qualified Crypto.Nonce as N
|
import qualified Crypto.Nonce as N
|
||||||
@ -173,8 +174,8 @@ allStorageTests storage it runIO parallel _shouldBe shouldReturn shouldThrow = d
|
|||||||
{ sessionKey = sid
|
{ sessionKey = sid
|
||||||
, sessionAuthId = Nothing
|
, sessionAuthId = Nothing
|
||||||
, sessionData = SessionMap $ HM.fromList vals
|
, sessionData = SessionMap $ HM.fromList vals
|
||||||
, sessionCreatedAt = now
|
, sessionCreatedAt = roundUTCTime now
|
||||||
, sessionAccessedAt = now
|
, sessionAccessedAt = roundUTCTime now
|
||||||
}
|
}
|
||||||
ver2 = session { sessionData = SessionMap HM.empty }
|
ver2 = session { sessionData = SessionMap HM.empty }
|
||||||
run (getSession storage sid) `shouldReturn` Nothing
|
run (getSession storage sid) `shouldReturn` Nothing
|
||||||
@ -223,8 +224,8 @@ generateSession gen hasAuthId = do
|
|||||||
{ sessionKey = sid
|
{ sessionKey = sid
|
||||||
, sessionAuthId = authId
|
, sessionAuthId = authId
|
||||||
, sessionData = SessionMap data_
|
, sessionData = SessionMap data_
|
||||||
, sessionCreatedAt = TI.addUTCTime (-1000) now
|
, sessionCreatedAt = roundUTCTime $ TI.addUTCTime (-1000) now
|
||||||
, sessionAccessedAt = now
|
, sessionAccessedAt = roundUTCTime $ now
|
||||||
}
|
}
|
||||||
|
|
||||||
data HasAuthId = HasAuthId | NoAuthId
|
data HasAuthId = HasAuthId | NoAuthId
|
||||||
|
|||||||
44
stack.yaml
44
stack.yaml
@ -1,4 +1,18 @@
|
|||||||
resolver: lts-12.13
|
flags:
|
||||||
|
serversession-backend-acid-state:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession-frontend-wai:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession-backend-persistent:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession-backend-redis:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession-frontend-yesod:
|
||||||
|
lib-Werror: true
|
||||||
|
serversession-frontend-snap:
|
||||||
|
lib-Werror: true
|
||||||
packages:
|
packages:
|
||||||
- serversession
|
- serversession
|
||||||
- serversession-backend-acid-state
|
- serversession-backend-acid-state
|
||||||
@ -8,25 +22,11 @@ packages:
|
|||||||
- serversession-frontend-wai
|
- serversession-frontend-wai
|
||||||
- serversession-frontend-yesod
|
- serversession-frontend-yesod
|
||||||
- examples/serversession-example-yesod-persistent
|
- examples/serversession-example-yesod-persistent
|
||||||
flags:
|
|
||||||
serversession:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-backend-acid-state:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-backend-persistent:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-backend-redis:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-frontend-snap:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-frontend-wai:
|
|
||||||
lib-Werror: true
|
|
||||||
serversession-frontend-yesod:
|
|
||||||
lib-Werror: true
|
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- acid-state-0.14.3
|
- snap-1.1.3.0@sha256:0c0814d2ab1c3d5f22cef4615b2913ded18e87710ea6febdbe6e3ab8d9838735,8872
|
||||||
- snap-1.1.1.0
|
- acid-state-0.16.0@sha256:a5640fd8d99bdb5f152476a2ae56cc8eb81864b280c8ec7d1387e81296ed844d,6190
|
||||||
- heist-1.1
|
- heist-1.1.0.1@sha256:7355cf8c1a7ef84c0c800c0539f7b99e7e540cace697238009a2dea1f05231f1,9311
|
||||||
- map-syntax-0.3
|
- map-syntax-0.3@sha256:ca8b449615fa57419c16a5e98844624a6ac758692b87b3cfae8c74c87c56f1b2,2420
|
||||||
- pwstore-fast-2.4.4
|
- pwstore-fast-2.4.4@sha256:9b6a37510d8b9f37f409a8ab3babac9181afcaaa3fce8ba1c131a7ed3de30698,1351
|
||||||
- xmlhtml-0.2.5.2
|
- xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
||||||
|
resolver: lts-15.8
|
||||||
|
|||||||
54
stack.yaml.lock
Normal file
54
stack.yaml.lock
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# This file was autogenerated by Stack.
|
||||||
|
# You should not edit this file by hand.
|
||||||
|
# For more information, please see the documentation at:
|
||||||
|
# https://docs.haskellstack.org/en/stable/lock_files
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- completed:
|
||||||
|
hackage: snap-1.1.3.0@sha256:0c0814d2ab1c3d5f22cef4615b2913ded18e87710ea6febdbe6e3ab8d9838735,8872
|
||||||
|
pantry-tree:
|
||||||
|
size: 5743
|
||||||
|
sha256: 804f55a8cab81e720547308e799243e81f43e089b860c0d3160a938cad86ed0d
|
||||||
|
original:
|
||||||
|
hackage: snap-1.1.3.0@sha256:0c0814d2ab1c3d5f22cef4615b2913ded18e87710ea6febdbe6e3ab8d9838735,8872
|
||||||
|
- completed:
|
||||||
|
hackage: acid-state-0.16.0@sha256:a5640fd8d99bdb5f152476a2ae56cc8eb81864b280c8ec7d1387e81296ed844d,6190
|
||||||
|
pantry-tree:
|
||||||
|
size: 13678
|
||||||
|
sha256: c6e4b7f00d2a500e6286beafe3a2da7ba898a9ea31f5744df57cdce8a8f5890f
|
||||||
|
original:
|
||||||
|
hackage: acid-state-0.16.0@sha256:a5640fd8d99bdb5f152476a2ae56cc8eb81864b280c8ec7d1387e81296ed844d,6190
|
||||||
|
- completed:
|
||||||
|
hackage: heist-1.1.0.1@sha256:7355cf8c1a7ef84c0c800c0539f7b99e7e540cace697238009a2dea1f05231f1,9311
|
||||||
|
pantry-tree:
|
||||||
|
size: 7354
|
||||||
|
sha256: a2635ed49de6debaf8b98189989f83ab58dcc125c6ae8e57f6fe0903bc7fa8ff
|
||||||
|
original:
|
||||||
|
hackage: heist-1.1.0.1@sha256:7355cf8c1a7ef84c0c800c0539f7b99e7e540cace697238009a2dea1f05231f1,9311
|
||||||
|
- completed:
|
||||||
|
hackage: map-syntax-0.3@sha256:ca8b449615fa57419c16a5e98844624a6ac758692b87b3cfae8c74c87c56f1b2,2420
|
||||||
|
pantry-tree:
|
||||||
|
size: 558
|
||||||
|
sha256: c196bee0433f9540e4251ebd1be06d802ff7cc4931e6f0aedc38babd28683a3c
|
||||||
|
original:
|
||||||
|
hackage: map-syntax-0.3@sha256:ca8b449615fa57419c16a5e98844624a6ac758692b87b3cfae8c74c87c56f1b2,2420
|
||||||
|
- completed:
|
||||||
|
hackage: pwstore-fast-2.4.4@sha256:9b6a37510d8b9f37f409a8ab3babac9181afcaaa3fce8ba1c131a7ed3de30698,1351
|
||||||
|
pantry-tree:
|
||||||
|
size: 270
|
||||||
|
sha256: ff4a44ede62515efe5cd366a5803f7183c811c4a0cf56eea88da94181c4844c0
|
||||||
|
original:
|
||||||
|
hackage: pwstore-fast-2.4.4@sha256:9b6a37510d8b9f37f409a8ab3babac9181afcaaa3fce8ba1c131a7ed3de30698,1351
|
||||||
|
- completed:
|
||||||
|
hackage: xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
||||||
|
pantry-tree:
|
||||||
|
size: 61835
|
||||||
|
sha256: bb1bd95db3738e18d112bbc9724510ee64a51b7eda61494507f4957c5e2281f6
|
||||||
|
original:
|
||||||
|
hackage: xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
||||||
|
snapshots:
|
||||||
|
- completed:
|
||||||
|
size: 492015
|
||||||
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/8.yaml
|
||||||
|
sha256: 926bc3d70249dd0ba05277ff00943c0addb35b627cb641752669e7cf771310d0
|
||||||
|
original: lts-15.8
|
||||||
Loading…
Reference in New Issue
Block a user