Copyright | PublicDomain |
---|---|
Maintainer | lemmih@gmail.com |
Portability | non-portable (uses GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Common structures used by the various backends (local, memory).
Synopsis
- class IsAcidic st where
- acidEvents :: [Event st]
- newtype Update st a = Update {
- unUpdate :: State st a
- newtype Query st a = Query {
- unQuery :: Reader st a
- liftQuery :: Query st a -> Update st a
- type EventResult ev = MethodResult ev
- type EventState ev = MethodState ev
- data Event st where
- UpdateEvent :: UpdateEvent ev => (ev -> Update (EventState ev) (EventResult ev)) -> MethodSerialiser ev -> Event (EventState ev)
- QueryEvent :: QueryEvent ev => (ev -> Query (EventState ev) (EventResult ev)) -> MethodSerialiser ev -> Event (EventState ev)
- class Method ev => UpdateEvent ev
- class Method ev => QueryEvent ev
- eventsToMethods :: [Event st] -> [MethodContainer st]
Documentation
class IsAcidic st where Source #
:: [Event st] | List of events capable of updating or querying the state. |
Context monad for Update events.
Context monad for Query events.
type EventResult ev = MethodResult ev Source #
Events return the same thing as Methods. The exact type of EventResult
depends on the event.
type EventState ev = MethodState ev Source #
We distinguish between events that modify the state and those that do not.
UpdateEvents are executed in a MonadState context and have to be serialized to disk before they are considered durable.
QueryEvents are executed in a MonadReader context and obviously do not have to be serialized to disk.
UpdateEvent :: UpdateEvent ev => (ev -> Update (EventState ev) (EventResult ev)) -> MethodSerialiser ev -> Event (EventState ev) | |
QueryEvent :: QueryEvent ev => (ev -> Query (EventState ev) (EventResult ev)) -> MethodSerialiser ev -> Event (EventState ev) |
class Method ev => UpdateEvent ev Source #
All UpdateEvents are also Methods.
class Method ev => QueryEvent ev Source #
All QueryEvents are also Methods.
eventsToMethods :: [Event st] -> [MethodContainer st] Source #