Safe Haskell | None |
---|---|
Language | Haskell98 |
Web.ServerSession.Backend.Acid.Internal
Contents
Description
Internal module exposing the guts of the package. Use at your own risk. No API stability guarantees apply.
- type SessionIdToSession sess = HashMap (SessionId sess) (Session sess)
- type AuthIdToSessionId sess = HashMap AuthId (Set (SessionId sess))
- data ServerSessionAcidState sess = ServerSessionAcidState {
- sessionIdToSession :: !(SessionIdToSession sess)
- authIdToSessionId :: !(AuthIdToSessionId sess)
- emptyState :: ServerSessionAcidState sess
- removeSessionFromAuthId :: SessionId sess -> Maybe AuthId -> AuthIdToSessionId sess -> AuthIdToSessionId sess
- insertSessionForAuthId :: SessionId sess -> Maybe AuthId -> AuthIdToSessionId sess -> AuthIdToSessionId sess
- getSession :: Storage (AcidStorage sess) => SessionId sess -> Query (ServerSessionAcidState sess) (Maybe (Session sess))
- deleteSession :: Storage (AcidStorage sess) => SessionId sess -> Update (ServerSessionAcidState sess) ()
- deleteAllSessionsOfAuthId :: Storage (AcidStorage sess) => AuthId -> Update (ServerSessionAcidState sess) ()
- insertSession :: Storage (AcidStorage sess) => Session sess -> Update (ServerSessionAcidState sess) ()
- replaceSession :: Storage (AcidStorage sess) => Session sess -> Update (ServerSessionAcidState sess) ()
- data GetSession sess
- data DeleteSession sess
- data DeleteAllSessionsOfAuthId sess
- data InsertSession sess
- data ReplaceSession sess
- newtype AcidStorage sess = AcidStorage {
- acidState :: AcidState (ServerSessionAcidState sess)
Documentation
type SessionIdToSession sess = HashMap (SessionId sess) (Session sess) #
Map from session IDs to sessions. The most important map, allowing us efficient access to a session given its ID.
type AuthIdToSessionId sess = HashMap AuthId (Set (SessionId sess)) #
Map from auth IDs to session IDs. Allow us to invalidate
all sessions of given user without having to iterate through
the whole SessionIdToSession
map.
data ServerSessionAcidState sess #
The current sessions.
Besides the obvious map from session IDs to sessions, we also maintain a map of auth IDs to session IDs. This allow us to quickly invalidate all sessions of a given user.
Constructors
ServerSessionAcidState | |
Fields
|
Instances
AcidContext sess => IsAcidic (ServerSessionAcidState sess) # | |
SafeCopy (Decomposed sess) => SafeCopy (ServerSessionAcidState sess) # | We can't |
emptyState :: ServerSessionAcidState sess #
Empty ServerSessionAcidState
used to bootstrap the AcidState
.
removeSessionFromAuthId :: SessionId sess -> Maybe AuthId -> AuthIdToSessionId sess -> AuthIdToSessionId sess #
Remove the given SessionId
from the set of the given
AuthId
on the map. Does not do anything if no AuthId
is
provided.
insertSessionForAuthId :: SessionId sess -> Maybe AuthId -> AuthIdToSessionId sess -> AuthIdToSessionId sess #
Insert the given session ID as being part of the given auth
ID. Conceptually the opposite of removeSessionFromAuthId
.
Does not do anything if no AuthId
is provided.
getSession :: Storage (AcidStorage sess) => SessionId sess -> Query (ServerSessionAcidState sess) (Maybe (Session sess)) #
Get the session for the given session ID.
deleteSession :: Storage (AcidStorage sess) => SessionId sess -> Update (ServerSessionAcidState sess) () #
Delete the session with given session ID.
deleteAllSessionsOfAuthId :: Storage (AcidStorage sess) => AuthId -> Update (ServerSessionAcidState sess) () #
Delete all sessions of the given auth ID.
insertSession :: Storage (AcidStorage sess) => Session sess -> Update (ServerSessionAcidState sess) () #
Insert a new session.
replaceSession :: Storage (AcidStorage sess) => Session sess -> Update (ServerSessionAcidState sess) () #
Replace the contents of a session.
data GetSession sess #
Instances
AcidContext sess => QueryEvent (GetSession sess) # | |
AcidContext sess => Method (GetSession sess) # | |
SafeCopy (GetSession sess) # | |
type MethodState (GetSession sess) # | |
type MethodResult (GetSession sess) # | |
data DeleteSession sess #
Instances
AcidContext sess => UpdateEvent (DeleteSession sess) # | |
AcidContext sess => Method (DeleteSession sess) # | |
SafeCopy (DeleteSession sess) # | |
type MethodState (DeleteSession sess) # | |
type MethodResult (DeleteSession sess) # | |
data DeleteAllSessionsOfAuthId sess #
Instances
AcidContext sess => UpdateEvent (DeleteAllSessionsOfAuthId sess) # | |
AcidContext sess => Method (DeleteAllSessionsOfAuthId sess) # | |
SafeCopy (DeleteAllSessionsOfAuthId sess) # | |
type MethodState (DeleteAllSessionsOfAuthId sess) # | |
type MethodResult (DeleteAllSessionsOfAuthId sess) # | |
data InsertSession sess #
Instances
AcidContext sess => UpdateEvent (InsertSession sess) # | |
AcidContext sess => Method (InsertSession sess) # | |
SafeCopy (Decomposed sess) => SafeCopy (InsertSession sess) # | |
type MethodState (InsertSession sess) # | |
type MethodResult (InsertSession sess) # | |
data ReplaceSession sess #
Instances
AcidContext sess => UpdateEvent (ReplaceSession sess) # | |
AcidContext sess => Method (ReplaceSession sess) # | |
SafeCopy (Decomposed sess) => SafeCopy (ReplaceSession sess) # | |
type MethodState (ReplaceSession sess) # | |
type MethodResult (ReplaceSession sess) # | |
newtype AcidStorage sess #
Session storage backend using acid-state
.
Constructors
AcidStorage | |
Fields
|
Instances
(IsSessionData sess, SafeCopy sess, SafeCopy (Decomposed sess)) => Storage (AcidStorage sess) # | We do not provide any ACID guarantees for different actions
running inside the same |
type TransactionM (AcidStorage sess) # | |
type SessionData (AcidStorage sess) # | |
Orphan instances
SafeCopy SessionMap # | We can't |
SafeCopy (SessionId sess) # | We can't |
SafeCopy (Decomposed sess) => SafeCopy (Session sess) # | We can't |