Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data StreamFamily streamId eventId metadata event = StreamFamily {
- connectionPool :: forall a. (Connection -> IO a) -> IO a
- relation :: Query
- notificationChannel :: Query
- parseNotification :: ByteString -> Either String (streamId, eventId)
- streamIdentifierColumn :: Query
- eventIdentifierColumn :: Query
- metadataColumns :: [Query]
- eventColumn :: Query
- makeStreamFamily :: (forall a. (Connection -> IO a) -> IO a) -> Query -> Query -> (ByteString -> Either String (streamId, eventId)) -> Query -> Query -> [Query] -> Query -> StreamFamily streamId eventId metadata event
Documentation
data StreamFamily streamId eventId metadata event Source #
Family of event streams stored in a PostgreSQL relation.
Each stream should have a unique stream identifier and event identifiers must be unique within a stream, but not necessarily across them.
allNewEvents
starts a new thread which reads notifications on the given
channel and writes them to a transactional bounded queue (a TBQueue
) which
is then consumed by the returned Producer
. The maximum size of this queue
is hard-coded to 100. Should an exception be raised in the listening thread,
it is thrown back by the producer.
StreamFamily | |
|
Instances
(Event event, MonadError Error m, MonadIO m, FromField eventId, FromField streamId, FromField (EncodingFormat event), FromRow metadata, ToField eventId, ToField streamId) => StreamFamily m (StreamFamily streamId eventId metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.StreamFamily type StreamType (StreamFamily streamId eventId metadata event) :: Type # type StreamIdentifier (StreamFamily streamId eventId metadata event) :: Type # getStream :: StreamFamily streamId eventId metadata event -> StreamIdentifier (StreamFamily streamId eventId metadata event) -> m (StreamType (StreamFamily streamId eventId metadata event)) # allNewEvents :: StreamFamily streamId eventId metadata event -> m (Producer [(StreamIdentifier (StreamFamily streamId eventId metadata event), Either (EventIdentifier (StreamType (StreamFamily streamId eventId metadata event)), String) (EventWithContext' (StreamType (StreamFamily streamId eventId metadata event))))] m a) # latestEventIdentifiers :: StreamFamily streamId eventId metadata event -> Producer (StreamIdentifier (StreamFamily streamId eventId metadata event), EventIdentifier (StreamType (StreamFamily streamId eventId metadata event))) m () # | |
type StreamIdentifier (StreamFamily streamId eventId metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.StreamFamily | |
type StreamType (StreamFamily streamId eventId metadata event) Source # | |
Defined in Database.CQRS.PostgreSQL.StreamFamily |
makeStreamFamily :: (forall a. (Connection -> IO a) -> IO a) -> Query -> Query -> (ByteString -> Either String (streamId, eventId)) -> Query -> Query -> [Query] -> Query -> StreamFamily streamId eventId metadata event Source #