Copyright | PublicDomain |
---|---|
Maintainer | lemmih@gmail.com |
Portability | non-portable (uses GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Home of the more specialized functions.
Synopsis
- scheduleUpdate :: UpdateEvent event => AcidState (EventState event) -> event -> IO (MVar (EventResult event))
- groupUpdates :: UpdateEvent event => AcidState (EventState event) -> [event] -> IO ()
- update' :: (UpdateEvent event, MonadIO m) => AcidState (EventState event) -> event -> m (EventResult event)
- query' :: (QueryEvent event, MonadIO m) => AcidState (EventState event) -> event -> m (EventResult event)
- class Method ev where
- type MethodResult ev
- type MethodState ev
- methodTag :: ev -> Tag
- class IsAcidic st where
- acidEvents :: [Event st]
- 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)
- safeCopySerialiser :: SafeCopy a => Serialiser a
- safeCopyMethodSerialiser :: (SafeCopy method, SafeCopy (MethodResult method)) => MethodSerialiser method
- defaultArchiver :: Archiver
Documentation
scheduleUpdate :: UpdateEvent event => AcidState (EventState event) -> event -> IO (MVar (EventResult event)) Source #
Issue an Update event and return immediately. The event is not durable
before the MVar has been filled but the order of events is honored.
The behavior in case of exceptions is exactly the same as for update
.
If EventA is scheduled before EventB, EventA will be executed before EventB:
do scheduleUpdate acid EventA scheduleUpdate acid EventB
groupUpdates :: UpdateEvent event => AcidState (EventState event) -> [event] -> IO () Source #
Schedule multiple Update events and wait for them to be durable, but throw away their results. This is useful for importing existing datasets into an AcidState.
update' :: (UpdateEvent event, MonadIO m) => AcidState (EventState event) -> event -> m (EventResult event) Source #
Same as update
but lifted into any monad capable of doing IO.
query' :: (QueryEvent event, MonadIO m) => AcidState (EventState event) -> event -> m (EventResult event) Source #
Same as query
but lifted into any monad capable of doing IO.
class Method ev where Source #
The basic Method class. Each Method has an indexed result type and a unique tag.
Nothing
type MethodResult ev Source #
type MethodState ev Source #
class IsAcidic st where Source #
:: [Event st] | List of events capable of updating or querying the state. |
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) |
safeCopySerialiser :: SafeCopy a => Serialiser a Source #
Default implementation of Serialiser
interface using SafeCopy
.
safeCopyMethodSerialiser :: (SafeCopy method, SafeCopy (MethodResult method)) => MethodSerialiser method Source #
Default implementation of MethodSerialiser
interface using SafeCopy
.
defaultArchiver :: Archiver Source #
Standard (and historically the only) implementation of the
Archiver
interface. This represents each entry in the following
format:
| entry length | crc16 | entry | | 8 bytes | 2 bytes | n bytes |