cqrs-core-0.10.0: Command-Query Responsibility Segregation

Safe HaskellNone
LanguageHaskell2010

Data.CQRS.Types.EventStore

Synopsis

Documentation

data EventStore e Source

EventStore for events of type e.

Constructors

EventStore 

Fields

esStoreEvents :: UUID -> [PersistedEvent e] -> IO ()

Store new events for an aggregate. May throw StoreError exception if there's a problem storing the events. Guarantees atomicity, i.e. either all the events are stored, or none of them are (in the case of errors or conflicts).

esRetrieveEvents :: forall a. UUID -> Int -> (InputStream (PersistedEvent e) -> IO a) -> IO a

Process sequence of events associated with the aggregate identified by the given UUID. Only events at or after the given version number are supplied by the input stream. The events are supplied in increasing order of version number.

esRetrieveAllEvents :: forall a. (InputStream (UUID, PersistedEvent e) -> IO a) -> IO a

Read all events from the event store. Events will be returned in order of increasing version number, grouped by aggregate UUID. __This function should ONLY be used for debugging purposes.__

data StoreError Source

Errors that can happen during esStoreEvents.

Constructors

VersionConflict UUID 

applyIso :: forall e' e. (e' -> e, e -> e') -> EventStore e -> EventStore e' Source

Transform an implementation of 'EventStore a' to an implementation of 'EventStore b' via an isomorphism. This can be used to add serialization/deserialization to event stores which do not support storing anything other than binary data.