Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Stream metadata event
- emptyStream :: MonadIO m => m (Stream metadata event)
- data StreamFamily identifier metadata event
- emptyStreamFamily :: forall metadata identifier event m. MonadIO m => m (StreamFamily identifier metadata event)
Documentation
data Stream metadata event Source #
In-memory event stream.
It's using STM internally so it's safe to have different thread writing events to the stream concurrently. Its main purpose is for tests but it could be used for production code as well.
Instances
emptyStream :: MonadIO m => m (Stream metadata event) Source #
Initialise an empty event stream.
data StreamFamily identifier metadata event Source #
A family of in-memory streams.
There are two things to be aware of when using this type:
getStream
adds a new empty stream to the family regardless of whether it's
used or not. If an attacker can make your application call getStream
with
arbitrary stream identifiers, it can lead to a Denial-of-Service attack.
Slow consumers of event notifications (from allNewEvents
) could become an
issue if events are written at a higher pace that they can keep up with. In
order to avoid the queue of notifications to grow bigger and bigger, it's
capped at 100 (hard-coded for now.) This means that writing a new event can
be blocked by a full consumer's queue.
Instances
(Eq identifier, Hashable identifier, MonadIO m) => StreamFamily m (StreamFamily identifier metadata event) Source # | |
Defined in Database.CQRS.InMemory type StreamType (StreamFamily identifier metadata event) :: Type Source # type StreamIdentifier (StreamFamily identifier metadata event) :: Type Source # getStream :: StreamFamily identifier metadata event -> StreamIdentifier (StreamFamily identifier metadata event) -> m (StreamType (StreamFamily identifier metadata event)) Source # allNewEvents :: StreamFamily identifier metadata event -> m (Producer [(StreamIdentifier (StreamFamily identifier metadata event), Either (EventIdentifier (StreamType (StreamFamily identifier metadata event)), String) (EventWithContext' (StreamType (StreamFamily identifier metadata event))))] m a) Source # latestEventIdentifiers :: StreamFamily identifier metadata event -> Producer (StreamIdentifier (StreamFamily identifier metadata event), EventIdentifier (StreamType (StreamFamily identifier metadata event))) m () Source # | |
type StreamType (StreamFamily identifier metadata event) Source # | |
Defined in Database.CQRS.InMemory | |
type StreamIdentifier (StreamFamily identifier metadata event) Source # | |
Defined in Database.CQRS.InMemory |
emptyStreamFamily :: forall metadata identifier event m. MonadIO m => m (StreamFamily identifier metadata event) Source #
Initialise an empty stream family.