cqrs-0.1.0: Command-Query Responsibility Segregation



Event store data types.



data EventStore Source

Event stores are the backend used for reading and storing all the information about recorded events.




storeEvents :: (Event e a, Binary e) => GUID a -> Int -> [e] -> IO ()

Store a sequence of events for aggregate identified by GUID into the event store, starting at the provided version number. If the version number does not match the expected value, a failure occurs.

retrieveEvents :: (Event e a, Binary e) => GUID a -> IO (Int, [e])

Retrieve the sequence of events associated with the aggregate identified by the given GUID. The events are returned in increasing order of version number. The version number of the last event is returned as well.

withTransaction :: forall a. IO a -> IO a

Run transaction against the event store. The transaction is expected to commit if the supplied IO action runs to completion (i.e. doesn't throw an exception) and to rollback otherwise.

closeEventStore :: IO ()

Close the event store.