eventsource-api-1.5.1: Provides an eventsourcing high level API.

Copyright(C) 2016 Yorick Laupa
License(see the file LICENSE)
MaintainerYorick Laupa <yo.eight@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

EventSource.Store

Description

 
Synopsis

Documentation

data Batch' a Source #

Represents batch information needed to read a stream.

Constructors

Batch' 

Fields

data Subscription Source #

A subscription allows to be notified on every change occuring on a stream.

Constructors

Subscription 

class Store store where Source #

Main event store abstraction. It exposes essential features expected from an event store.

Minimal complete definition

appendEvents, readStream, subscribe

Methods

appendEvents :: (EncodeEvent a, MonadBase IO m) => store -> StreamName -> ExpectedVersion -> [a] -> m (Async EventNumber) Source #

Appends a batch of events at the end of a stream.

readStream :: MonadBase IO m => store -> StreamName -> Batch -> Stream (Of SavedEvent) (ExceptT ReadFailure m) () Source #

Reads a stream in a stream-processing fashion.

subscribe :: MonadBase IO m => store -> StreamName -> m Subscription Source #

Subscribes to given stream.

toStore :: store -> SomeStore Source #

Encapsulates to an abstract store.

data SomeStore Source #

Utility type to pass any store that implements Store typeclass.

Constructors

Store store => SomeStore store 

freshSubscriptionId :: MonadBase IO m => m SubscriptionId Source #

Returns a fresh subscription id.

startFrom :: a -> Batch' a Source #

Starts a Batch from a given point. The batch size is set to default, which is 500.

appendEvent :: (EncodeEvent a, MonadBase IO m, Store store) => store -> StreamName -> ExpectedVersion -> a -> m (Async EventNumber) Source #

Appends a single event at the end of a stream.

unhandled :: (MonadBase IO m, Exception e) => Stream (Of a) (ExceptT e m) () -> Stream (Of a) m () Source #

Throws an exception in case ExceptT was a Left.