| Copyright | (C) 2014 Yorick Laupa |
|---|---|
| License | (see the file LICENSE) |
| Maintainer | Yorick Laupa <[email protected]> |
| Stability | provisional |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Database.EventStore
Description
- data Event
- data EventData
- data Connection
- data ExpectedVersion
- = Any
- | NoStream
- | EmptyStream
- type HostName = String
- type Port = Int
- data Subscription = Subscription {
- subId :: !UUID
- subStream :: !Text
- subResolveLinkTos :: !Bool
- subEventChan :: !(TChan (Either DropReason ResolvedEventBuf))
- subLastCommitPos :: !Int64
- subLastEventNumber :: !(Maybe Int32)
- subUnsubscribe :: IO ()
- data AllEventsSlice = AllEventsSlice {
- allEventsSliceResult :: !ReadAllResult
- allEventsSliceFrom :: !Position
- allEventsSliceNext :: !Position
- allEventsSliceIsEOS :: !Bool
- allEventsSliceEvents :: ![ResolvedEvent]
- allEventsSliceDirection :: !ReadDirection
- newtype DeleteResult = DeleteResult {
- deleteStreamPosition :: Position
- data WriteResult = WriteResult {
- writeNextExpectedVersion :: !Int32
- writePosition :: !Position
- data ReadResult = ReadResult {
- readResultStatus :: !ReadEventResult
- readResultStreamId :: !Text
- readResultEventNumber :: !Int32
- readResultResolvedEvent :: !(Maybe ResolvedEvent)
- data RecordedEvent = RecordedEvent {}
- data StreamEventsSlice = StreamEventsSlice {
- streamEventsSliceResult :: !ReadStreamResult
- streamEventsSliceStreamId :: !Text
- streamEventsSliceStart :: !Int32
- streamEventsSliceNext :: !Int32
- streamEventsSliceLast :: !Int32
- streamEventsSliceIsEOS :: !Bool
- streamEventsSliceEvents :: ![ResolvedEvent]
- streamEventsSliceDirection :: !ReadDirection
- eventResolved :: ResolvedEvent -> Bool
- resolvedEventOriginal :: ResolvedEvent -> Maybe RecordedEvent
- resolvedEventOriginalStreamId :: ResolvedEvent -> Maybe Text
- createEvent :: Text -> EventData -> Event
- withJson :: Value -> EventData
- withJsonAndMetadata :: Value -> Value -> EventData
- defaultSettings :: Settings
- connect :: Settings -> HostName -> Port -> IO Connection
- deleteStream :: Connection -> Text -> ExpectedVersion -> Maybe Bool -> IO (Async DeleteResult)
- readEvent :: Connection -> Text -> Int32 -> Bool -> IO (Async ReadResult)
- readAllEventsBackward :: Connection -> Int64 -> Int64 -> Int32 -> Bool -> IO (Async AllEventsSlice)
- readAllEventsForward :: Connection -> Int64 -> Int64 -> Int32 -> Bool -> IO (Async AllEventsSlice)
- readStreamEventsBackward :: Connection -> Text -> Int32 -> Int32 -> Bool -> IO (Async StreamEventsSlice)
- readStreamEventsForward :: Connection -> Text -> Int32 -> Int32 -> Bool -> IO (Async StreamEventsSlice)
- sendEvent :: Connection -> Text -> ExpectedVersion -> Event -> IO (Async WriteResult)
- sendEvents :: Connection -> Text -> ExpectedVersion -> [Event] -> IO (Async WriteResult)
- shutdown :: Connection -> IO ()
- transactionStart :: Connection -> Text -> ExpectedVersion -> IO (Async Transaction)
- subscribe :: Connection -> Text -> Bool -> IO (Async Subscription)
- data Transaction
- transactionCommit :: Transaction -> IO (Async WriteResult)
- transactionRollback :: Transaction -> IO ()
- transactionSendEvents :: Transaction -> [Event] -> IO (Async ())
- module Control.Concurrent.Async
Documentation
data Connection Source
data ExpectedVersion Source
Constructors
| Any | Says that you should not conflict with anything |
| NoStream | Stream should not exist when doing your write |
| EmptyStream | Stream should exist but be empty when doing the write |
Instances
data Subscription Source
Constructors
| Subscription | |
Fields
| |
Result
data AllEventsSlice Source
Constructors
| AllEventsSlice | |
Fields
| |
Instances
newtype DeleteResult Source
Constructors
| DeleteResult | |
Fields
| |
Instances
data WriteResult Source
Constructors
| WriteResult | |
Fields
| |
Instances
data ReadResult Source
Constructors
| ReadResult | |
Fields
| |
Instances
data RecordedEvent Source
Constructors
| RecordedEvent | |
Fields
| |
Instances
data StreamEventsSlice Source
Constructors
| StreamEventsSlice | |
Fields
| |
Instances
eventResolved :: ResolvedEvent -> Bool Source
resolvedEventOriginal :: ResolvedEvent -> Maybe RecordedEvent Source
resolvedEventOriginalStreamId :: ResolvedEvent -> Maybe Text Source
Event
createEvent :: Text -> EventData -> Event Source
withJsonAndMetadata :: Value -> Value -> EventData Source
Connection manager
defaultSettings :: Settings Source
connect :: Settings -> HostName -> Port -> IO Connection Source
Creates a new connection to a single node. It maintains a full duplex
connection to the EventStore. An EventStore Connection operates quite
differently than say a SQL connection. Normally when you use a SQL
connection you want to keep the connection open for a much longer of time
than when you use a SQL connection.
Another difference is that with the EventStore Connection all operation
are handled in a full async manner (even if you call the synchronous
behaviors). Many threads can use an EvenStore connection at the same time
or a single thread can make many asynchronous requests. To get the most
performance out of the connection it is generally recommend to use it in
this way
Arguments
| :: Connection | |
| -> Text | |
| -> ExpectedVersion | |
| -> Maybe Bool | Hard delete |
| -> IO (Async DeleteResult) |
readEvent :: Connection -> Text -> Int32 -> Bool -> IO (Async ReadResult) Source
readAllEventsBackward :: Connection -> Int64 -> Int64 -> Int32 -> Bool -> IO (Async AllEventsSlice) Source
readAllEventsForward :: Connection -> Int64 -> Int64 -> Int32 -> Bool -> IO (Async AllEventsSlice) Source
readStreamEventsBackward :: Connection -> Text -> Int32 -> Int32 -> Bool -> IO (Async StreamEventsSlice) Source
readStreamEventsForward :: Connection -> Text -> Int32 -> Int32 -> Bool -> IO (Async StreamEventsSlice) Source
Arguments
| :: Connection | |
| -> Text | Stream |
| -> ExpectedVersion | |
| -> Event | |
| -> IO (Async WriteResult) |
Arguments
| :: Connection | |
| -> Text | Stream |
| -> ExpectedVersion | |
| -> [Event] | |
| -> IO (Async WriteResult) |
shutdown :: Connection -> IO () Source
transactionStart :: Connection -> Text -> ExpectedVersion -> IO (Async Transaction) Source
subscribe :: Connection -> Text -> Bool -> IO (Async Subscription) Source
Transaction
data Transaction Source
transactionCommit :: Transaction -> IO (Async WriteResult) Source
transactionRollback :: Transaction -> IO () Source
transactionSendEvents :: Transaction -> [Event] -> IO (Async ()) Source
Re-export
module Control.Concurrent.Async