eventsourcing-postgresql-0.9.0: PostgreSQL adaptor for eventsourcing.

Safe HaskellNone
LanguageHaskell2010

Database.CQRS.PostgreSQL.StreamFamily

Synopsis

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.

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 # 
Instance details

Defined in Database.CQRS.PostgreSQL.StreamFamily

Associated Types

type StreamType (StreamFamily streamId eventId metadata event) :: Type #

type StreamIdentifier (StreamFamily streamId eventId metadata event) :: Type #

Methods

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 # 
Instance details

Defined in Database.CQRS.PostgreSQL.StreamFamily

type StreamIdentifier (StreamFamily streamId eventId metadata event) = streamId
type StreamType (StreamFamily streamId eventId metadata event) Source # 
Instance details

Defined in Database.CQRS.PostgreSQL.StreamFamily

type StreamType (StreamFamily streamId eventId metadata event) = Stream eventId metadata event

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 #