Copyright | (C) 2014 Yorick Laupa |
---|---|
License | (see the file LICENSE) |
Maintainer | Yorick Laupa <yo.eight@gmail.com> |
Stability | provisional |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Connection
- data ConnectionType
- data Credentials
- data Settings = Settings {
- s_heartbeatInterval :: NominalDiffTime
- s_heartbeatTimeout :: NominalDiffTime
- s_requireMaster :: Bool
- s_retry :: Retry
- s_reconnect_delay :: NominalDiffTime
- s_ssl :: Maybe TLSSettings
- s_loggerType :: LogType
- s_loggerFilter :: LoggerFilter
- s_loggerDetailed :: Bool
- s_operationTimeout :: NominalDiffTime
- s_operationRetry :: Retry
- s_monitoring :: Maybe Store
- s_defaultConnectionName :: Maybe Text
- s_defaultUserCredentials :: Maybe Credentials
- data Retry
- atMost :: Int -> Retry
- keepRetrying :: Retry
- credentials :: ByteString -> ByteString -> Credentials
- defaultSettings :: Settings
- defaultSSLSettings :: TLSSettings -> Settings
- connect :: Settings -> ConnectionType -> IO Connection
- shutdown :: Connection -> IO ()
- waitTillClosed :: Connection -> IO ()
- connectionSettings :: Connection -> Settings
- data ClusterSettings = ClusterSettings {}
- data DnsServer
- data GossipSeed
- gossipSeed :: String -> Int -> GossipSeed
- gossipSeedWithHeader :: String -> Int -> String -> GossipSeed
- gossipSeedHost :: GossipSeed -> String
- gossipSeedHeader :: GossipSeed -> String
- gossipSeedPort :: GossipSeed -> Int
- gossipSeedClusterSettings :: NonEmpty GossipSeed -> ClusterSettings
- dnsClusterSettings :: ByteString -> ClusterSettings
- data Event
- data EventData
- data EventType
- createEvent :: EventType -> Maybe UUID -> EventData -> Event
- withJson :: ToJSON a => a -> EventData
- withJsonAndMetadata :: (ToJSON a, ToJSON b) => a -> b -> EventData
- withBinary :: ByteString -> EventData
- withBinaryAndMetadata :: ByteString -> ByteString -> EventData
- data OperationMaxAttemptReached = OperationMaxAttemptReached UUID Command
- data StreamMetadataResult
- readEvent :: Connection -> StreamName -> Int32 -> Bool -> Maybe Credentials -> IO (Async (ReadResult RegularStream ReadEvent))
- readAllEventsBackward :: Connection -> Position -> Int32 -> Bool -> Maybe Credentials -> IO (Async AllSlice)
- readAllEventsForward :: Connection -> Position -> Int32 -> Bool -> Maybe Credentials -> IO (Async AllSlice)
- readStreamEventsBackward :: Connection -> StreamName -> Int64 -> Int32 -> Bool -> Maybe Credentials -> IO (Async (ReadResult RegularStream StreamSlice))
- readStreamEventsForward :: Connection -> StreamName -> Int64 -> Int32 -> Bool -> Maybe Credentials -> IO (Async (ReadResult RegularStream StreamSlice))
- getStreamMetadata :: Connection -> StreamName -> Maybe Credentials -> IO (Async StreamMetadataResult)
- data StreamACL = StreamACL {
- streamACLReadRoles :: ![Text]
- streamACLWriteRoles :: ![Text]
- streamACLDeleteRoles :: ![Text]
- streamACLMetaReadRoles :: ![Text]
- streamACLMetaWriteRoles :: ![Text]
- data StreamMetadata = StreamMetadata {}
- getCustomPropertyValue :: StreamMetadata -> Text -> Maybe Value
- getCustomProperty :: FromJSON a => StreamMetadata -> Text -> Maybe a
- emptyStreamACL :: StreamACL
- emptyStreamMetadata :: StreamMetadata
- deleteStream :: Connection -> StreamName -> ExpectedVersion -> Maybe Bool -> Maybe Credentials -> IO (Async DeleteResult)
- sendEvent :: Connection -> StreamName -> ExpectedVersion -> Event -> Maybe Credentials -> IO (Async WriteResult)
- sendEvents :: Connection -> StreamName -> ExpectedVersion -> [Event] -> Maybe Credentials -> IO (Async WriteResult)
- setStreamMetadata :: Connection -> StreamName -> ExpectedVersion -> StreamMetadata -> Maybe Credentials -> IO (Async WriteResult)
- type Builder a = Endo a
- type StreamACLBuilder = Builder StreamACL
- buildStreamACL :: StreamACLBuilder -> StreamACL
- modifyStreamACL :: StreamACLBuilder -> StreamACL -> StreamACL
- setReadRoles :: [Text] -> StreamACLBuilder
- setReadRole :: Text -> StreamACLBuilder
- setWriteRoles :: [Text] -> StreamACLBuilder
- setWriteRole :: Text -> StreamACLBuilder
- setDeleteRoles :: [Text] -> StreamACLBuilder
- setDeleteRole :: Text -> StreamACLBuilder
- setMetaReadRoles :: [Text] -> StreamACLBuilder
- setMetaReadRole :: Text -> StreamACLBuilder
- setMetaWriteRoles :: [Text] -> StreamACLBuilder
- setMetaWriteRole :: Text -> StreamACLBuilder
- type StreamMetadataBuilder = Builder StreamMetadata
- buildStreamMetadata :: StreamMetadataBuilder -> StreamMetadata
- modifyStreamMetadata :: StreamMetadataBuilder -> StreamMetadata -> StreamMetadata
- setMaxCount :: Int32 -> StreamMetadataBuilder
- setMaxAge :: TimeSpan -> StreamMetadataBuilder
- setTruncateBefore :: Int32 -> StreamMetadataBuilder
- setCacheControl :: TimeSpan -> StreamMetadataBuilder
- setACL :: StreamACL -> StreamMetadataBuilder
- modifyACL :: StreamACLBuilder -> StreamMetadataBuilder
- setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder
- data Transaction
- data TransactionId
- startTransaction :: Connection -> StreamName -> ExpectedVersion -> Maybe Credentials -> IO (Async Transaction)
- transactionId :: Transaction -> TransactionId
- transactionCommit :: Transaction -> Maybe Credentials -> IO (Async WriteResult)
- transactionRollback :: Transaction -> IO ()
- transactionWrite :: Transaction -> [Event] -> Maybe Credentials -> IO (Async ())
- data SubscriptionClosed = SubscriptionClosed (Maybe SubDropReason)
- data SubscriptionId
- class Subscription s where
- data SubDropReason
- = SubUnsubscribed
- | SubAccessDenied
- | SubNotFound
- | SubPersistDeleted
- | SubAborted
- | SubNotAuthenticated (Maybe Text)
- | SubServerError (Maybe Text)
- | SubNotHandled !NotHandledReason !(Maybe MasterInfo)
- | SubClientError !Text
- | SubSubscriberMaxCountReached
- data SubDetails
- waitConfirmation :: Subscription s => s -> IO ()
- unsubscribeConfirmed :: Subscription s => s -> IO Bool
- unsubscribeConfirmedSTM :: Subscription s => s -> STM Bool
- waitUnsubscribeConfirmed :: Subscription s => s -> IO ()
- nextEventMaybeSTM :: Subscription s => s -> STM (Maybe ResolvedEvent)
- getSubscriptionDetailsSTM :: Subscription s => s -> STM SubDetails
- unsubscribe :: Subscription s => s -> IO ()
- subscriptionStream :: Subscription s => s -> StreamName
- data RegularSubscription
- subscribe :: Connection -> StreamName -> Bool -> Maybe Credentials -> IO RegularSubscription
- subscribeToAll :: Connection -> Bool -> Maybe Credentials -> IO RegularSubscription
- getSubscriptionId :: Subscription s => s -> IO SubscriptionId
- isSubscribedToAll :: Subscription s => s -> Bool
- nextEvent :: Subscription s => s -> IO ResolvedEvent
- nextEventMaybe :: Subscription s => s -> IO (Maybe ResolvedEvent)
- data CatchupSubscription
- subscribeFrom :: Connection -> StreamName -> Bool -> Maybe Int64 -> Maybe Int32 -> Maybe Credentials -> IO CatchupSubscription
- subscribeToAllFrom :: Connection -> Bool -> Maybe Position -> Maybe Int32 -> Maybe Credentials -> IO CatchupSubscription
- waitTillCatchup :: CatchupSubscription -> IO ()
- hasCaughtUp :: CatchupSubscription -> IO Bool
- hasCaughtUpSTM :: CatchupSubscription -> STM Bool
- data PersistentSubscription
- data PersistentSubscriptionSettings = PersistentSubscriptionSettings {
- psSettingsResolveLinkTos :: !Bool
- psSettingsStartFrom :: !Int64
- psSettingsExtraStats :: !Bool
- psSettingsMsgTimeout :: !TimeSpan
- psSettingsMaxRetryCount :: !Int32
- psSettingsLiveBufSize :: !Int32
- psSettingsReadBatchSize :: !Int32
- psSettingsHistoryBufSize :: !Int32
- psSettingsCheckPointAfter :: !TimeSpan
- psSettingsMinCheckPointCount :: !Int32
- psSettingsMaxCheckPointCount :: !Int32
- psSettingsMaxSubsCount :: !Int32
- psSettingsNamedConsumerStrategy :: !SystemConsumerStrategy
- data SystemConsumerStrategy
- data NakAction
- = NA_Unknown
- | NA_Park
- | NA_Retry
- | NA_Skip
- | NA_Stop
- data PersistActionException
- acknowledge :: PersistentSubscription -> ResolvedEvent -> IO ()
- acknowledgeEvents :: PersistentSubscription -> [ResolvedEvent] -> IO ()
- failed :: PersistentSubscription -> ResolvedEvent -> NakAction -> Maybe Text -> IO ()
- eventsFailed :: PersistentSubscription -> [ResolvedEvent] -> NakAction -> Maybe Text -> IO ()
- notifyEventsProcessed :: PersistentSubscription -> [UUID] -> IO ()
- notifyEventsFailed :: PersistentSubscription -> NakAction -> Maybe Text -> [UUID] -> IO ()
- defaultPersistentSubscriptionSettings :: PersistentSubscriptionSettings
- createPersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
- updatePersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
- deletePersistentSubscription :: Connection -> Text -> StreamName -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
- connectToPersistentSubscription :: Connection -> Text -> StreamName -> Int32 -> Maybe Credentials -> IO PersistentSubscription
- class Slice a where
- type Loc a
- data AllSlice
- newtype DeleteResult = DeleteResult Position
- data WriteResult = WriteResult {}
- data ReadResult :: StreamType -> * -> * where
- ReadSuccess :: a -> ReadResult t a
- ReadNoStream :: ReadResult RegularStream a
- ReadStreamDeleted :: Text -> ReadResult RegularStream a
- ReadNotModified :: ReadResult t a
- ReadError :: Maybe Text -> ReadResult t a
- ReadAccessDenied :: StreamName -> ReadResult t a
- data RecordedEvent = RecordedEvent {}
- data ReadEvent
- = ReadEventNotFound {
- readEventStream :: !Text
- readEventNumber :: !Int32
- | ReadEvent { }
- = ReadEventNotFound {
- data StreamType
- = All
- | RegularStream
- data StreamSlice
- data Position = Position {
- positionCommit :: !Int64
- positionPrepare :: !Int64
- data ReadDirection
- data ResolvedEvent = ResolvedEvent {}
- data OperationError
- data StreamName
- isEventResolvedLink :: ResolvedEvent -> Bool
- resolvedEventOriginal :: ResolvedEvent -> RecordedEvent
- resolvedEventDataAsJson :: FromJSON a => ResolvedEvent -> Maybe a
- resolvedEventOriginalStreamId :: ResolvedEvent -> Text
- resolvedEventOriginalId :: ResolvedEvent -> UUID
- resolvedEventOriginalEventNumber :: ResolvedEvent -> Int64
- recordedEventDataAsJson :: FromJSON a => RecordedEvent -> Maybe a
- positionStart :: Position
- positionEnd :: Position
- data LogLevel :: *
- data LogType :: *
- = LogNone
- | LogStdout BufSize
- | LogStderr BufSize
- | LogFileNoRotate FilePath BufSize
- | LogFile FileLogSpec BufSize
- | LogCallback (LogStr -> IO ()) (IO ())
- data LoggerFilter
- = LoggerFilter (LogSource -> LogLevel -> Bool)
- | LoggerLevel LogLevel
- data Command
- data DropReason
- data ExpectedVersion
- anyVersion :: ExpectedVersion
- noStreamVersion :: ExpectedVersion
- emptyStreamVersion :: ExpectedVersion
- exactEventVersion :: Int64 -> ExpectedVersion
- streamExists :: ExpectedVersion
- msDiffTime :: Float -> NominalDiffTime
- (<>) :: Semigroup a => a -> a -> a
- data NonEmpty a :: * -> * = a :| [a]
- nonEmpty :: [a] -> Maybe (NonEmpty a)
- data TLSSettings :: *
- data NominalDiffTime :: *
Connection
data Connection Source #
Represents a connection to a single EventStore node.
data ConnectionType Source #
Gathers every connection type handled by the client.
Static String Int | HostName and Port. |
Cluster ClusterSettings | |
Dns ByteString (Maybe DnsServer) Int | Domain name, optional DNS server and port. |
data Credentials Source #
Holds login and password information.
Global Connection
settings
Settings | |
|
atMost :: Int -> Retry Source #
Indicates how many times we should try to reconnect to the server. A value less than or equal to 0 means no retry.
keepRetrying :: Retry Source #
Indicates we should try to reconnect to the server until the end of the Universe.
:: ByteString | Login |
-> ByteString | Password |
-> Credentials |
Creates a Credentials
given a login and a password.
defaultSettings :: Settings Source #
Default global settings.
s_heartbeatInterval
= 750 mss_heartbeatTimeout
= 1500 mss_requireMaster
=True
s_retry
=atMost
3s_reconnect_delay
= 3 secondss_ssl
=Nothing
s_loggerType
=LogNone
s_loggerFilter
=LoggerLevel
LevelInfo
s_loggerDetailed
=False
s_operationTimeout
= 10 secondss_operationRetry
=atMost
3s_monitoring
=Nothing
s_defaultConnectionName
=Nothing
s_defaultUserCredentials
=Nothing
defaultSSLSettings :: TLSSettings -> Settings Source #
Default SSL settings based on defaultSettings
.
connect :: Settings -> ConnectionType -> 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 an EventStore
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 operations
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 recommended to use it in
this way.
shutdown :: Connection -> IO () Source #
Asynchronously closes the Connection
.
waitTillClosed :: Connection -> IO () Source #
Waits the Connection
to be closed.
connectionSettings :: Connection -> Settings Source #
Returns a Connection
's Settings
.
Cluster Connection
data ClusterSettings Source #
Contains settings related to a connection to a cluster.
ClusterSettings | |
|
Tells how the DNS server should be contacted.
gossipSeed :: String -> Int -> GossipSeed Source #
Creates a GossipSeed
.
gossipSeedWithHeader :: String -> Int -> String -> GossipSeed Source #
Creates a GossipSeed
with a specific HTTP header.
gossipSeedHost :: GossipSeed -> String Source #
Returns GossipSeed
host IP address.
gossipSeedHeader :: GossipSeed -> String Source #
The host header to be sent when requesting gossip.
gossipSeedPort :: GossipSeed -> Int Source #
Returns GossipSeed
port.
gossipSeedClusterSettings :: NonEmpty GossipSeed -> ClusterSettings Source #
Configures a ClusterSettings
for connecting to a cluster using gossip
seeds.
clusterDns = ""
clusterMaxDiscoverAttempts = 10
clusterExternalGossipPort = 0
clusterGossipTimeout = 1s
dnsClusterSettings :: ByteString -> ClusterSettings Source #
Configures a ClusterSettings
for connecting to a cluster using DNS
discovery.
clusterMaxDiscoverAttempts = 10
clusterExternalGossipPort = 0
clusterGossipSeeds = Nothing
clusterGossipTimeout = 1s
Event
Contains event information like its type and data. Only used for write queries.
Constants for System event types.
StreamDeletedType | Event type for stream deleted. |
StatsCollectionType | Event type for statistics. |
LinkToType | Event type for linkTo. |
StreamMetadataType | Event type for stream metadata. |
SettingsType | Event type for the system settings. |
UserDefined Text | Event defined by the user. |
Create an Event
meant to be persisted.
withJsonAndMetadata :: (ToJSON a, ToJSON b) => a -> b -> EventData Source #
Creates an event with metadata using JSON format.
withBinary :: ByteString -> EventData Source #
Creates an event using a binary format.
withBinaryAndMetadata :: ByteString -> ByteString -> EventData Source #
Creates an event with metadata using binary format.
Common Operation types
data OperationMaxAttemptReached Source #
Occurs when an operation has been retried more than s_operationRetry
.
Read Operations
data StreamMetadataResult Source #
Represents stream metadata as a series of properties for system data and a
StreamMetadata
object for user metadata.
StreamMetadataResult | |
| |
NotFoundStreamMetadataResult | When the stream is either not found or 'no stream'. |
| |
DeletedStreamMetadataResult | When the stream is soft-deleted. |
|
:: Connection | |
-> StreamName | |
-> Int32 | Event number |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO (Async (ReadResult RegularStream ReadEvent)) |
Reads a single event from given stream.
readAllEventsBackward Source #
:: Connection | |
-> Position | |
-> Int32 | Batch size |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO (Async AllSlice) |
Reads events from the $all stream backward
:: Connection | |
-> Position | |
-> Int32 | Batch size |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO (Async AllSlice) |
Reads events from the $all stream forward.
readStreamEventsBackward Source #
:: Connection | |
-> StreamName | |
-> Int64 | From event number |
-> Int32 | Batch size |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO (Async (ReadResult RegularStream StreamSlice)) |
Reads events from a given stream backward.
readStreamEventsForward Source #
:: Connection | |
-> StreamName | |
-> Int64 | From event number |
-> Int32 | Batch size |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO (Async (ReadResult RegularStream StreamSlice)) |
Reads events from a given stream forward.
getStreamMetadata :: Connection -> StreamName -> Maybe Credentials -> IO (Async StreamMetadataResult) Source #
Asynchronously gets the metadata of a stream.
Write Operations
Represents an access control list for a stream.
StreamACL | |
|
data StreamMetadata Source #
Represents stream metadata with strongly typed properties for system values and a dictionary-like interface for custom values.
StreamMetadata | |
|
getCustomPropertyValue :: StreamMetadata -> Text -> Maybe Value Source #
Gets a custom property value from metadata.
getCustomProperty :: FromJSON a => StreamMetadata -> Text -> Maybe a Source #
Get a custom property value from metadata.
emptyStreamACL :: StreamACL Source #
StreamACL
with no role or users whatsoever.
emptyStreamMetadata :: StreamMetadata Source #
StreamMetadata
with everything set to Nothing
, using emptyStreamACL
and an empty Object
.
:: Connection | |
-> StreamName | |
-> ExpectedVersion | |
-> Maybe Bool | Hard delete |
-> Maybe Credentials | |
-> IO (Async DeleteResult) |
Deletes given stream.
sendEvent :: Connection -> StreamName -> ExpectedVersion -> Event -> Maybe Credentials -> IO (Async WriteResult) Source #
Sends a single Event
to given stream.
sendEvents :: Connection -> StreamName -> ExpectedVersion -> [Event] -> Maybe Credentials -> IO (Async WriteResult) Source #
Sends a list of Event
to given stream.
setStreamMetadata :: Connection -> StreamName -> ExpectedVersion -> StreamMetadata -> Maybe Credentials -> IO (Async WriteResult) Source #
Asynchronously sets the metadata for a stream.
Builder
Stream ACL Builder
buildStreamACL :: StreamACLBuilder -> StreamACL Source #
Builds a StreamACL
from a StreamACLBuilder
.
modifyStreamACL :: StreamACLBuilder -> StreamACL -> StreamACL Source #
Modifies a StreamACL
using a StreamACLBuilder
.
setReadRoles :: [Text] -> StreamACLBuilder Source #
Sets role names with read permission for the stream.
setReadRole :: Text -> StreamACLBuilder Source #
Sets a single role name with read permission for the stream.
setWriteRoles :: [Text] -> StreamACLBuilder Source #
Sets role names with write permission for the stream.
setWriteRole :: Text -> StreamACLBuilder Source #
Sets a single role name with write permission for the stream.
setDeleteRoles :: [Text] -> StreamACLBuilder Source #
Sets role names with delete permission for the stream.
setDeleteRole :: Text -> StreamACLBuilder Source #
Sets a single role name with delete permission for the stream.
setMetaReadRoles :: [Text] -> StreamACLBuilder Source #
Sets role names with metadata read permission for the stream.
setMetaReadRole :: Text -> StreamACLBuilder Source #
Sets a single role name with metadata read permission for the stream.
setMetaWriteRoles :: [Text] -> StreamACLBuilder Source #
Sets role names with metadata write permission for the stream.
setMetaWriteRole :: Text -> StreamACLBuilder Source #
Sets a single role name with metadata write permission for the stream.
Stream Metadata Builder
type StreamMetadataBuilder = Builder StreamMetadata Source #
A Builder
applies to StreamMetadata
.
buildStreamMetadata :: StreamMetadataBuilder -> StreamMetadata Source #
Builds a StreamMetadata
from a StreamMetadataBuilder
.
modifyStreamMetadata :: StreamMetadataBuilder -> StreamMetadata -> StreamMetadata Source #
Modifies a StreamMetadata
using a StreamMetadataBuilder
setMaxCount :: Int32 -> StreamMetadataBuilder Source #
Sets the maximum number of events allowed in the stream.
setMaxAge :: TimeSpan -> StreamMetadataBuilder Source #
Sets the maximum age of events allowed in the stream.
setTruncateBefore :: Int32 -> StreamMetadataBuilder Source #
Sets the event number from which previous events can be scavenged.
setCacheControl :: TimeSpan -> StreamMetadataBuilder Source #
Sets the amount of time for which the stream head is cachable.
setACL :: StreamACL -> StreamMetadataBuilder Source #
Overwrites any previous StreamACL
by the given one in a
StreamMetadataBuilder
.
modifyACL :: StreamACLBuilder -> StreamMetadataBuilder Source #
Updates a StreamMetadata'
s StreamACL
given a StreamACLBuilder
.
setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder Source #
Sets a custom metadata property.
Transaction
data Transaction Source #
Represents a multi-request transaction with the EventStore.
data TransactionId Source #
The id of a Transaction
.
:: Connection | |
-> StreamName | Stream name |
-> ExpectedVersion | |
-> Maybe Credentials | |
-> IO (Async Transaction) |
Starts a transaction on given stream.
transactionId :: Transaction -> TransactionId Source #
Gets the id of a Transaction
.
transactionCommit :: Transaction -> Maybe Credentials -> IO (Async WriteResult) Source #
Asynchronously commits this transaction.
transactionRollback :: Transaction -> IO () Source #
There isn't such of thing in EventStore parlance. Basically, if you want to
rollback, you just have to not transactionCommit
a Transaction
.
transactionWrite :: Transaction -> [Event] -> Maybe Credentials -> IO (Async ()) Source #
Asynchronously writes to a transaction in the EventStore.
Subscription
data SubscriptionClosed Source #
data SubscriptionId Source #
Represents a subscription id.
class Subscription s where Source #
Common operations supported by a subscription.
nextEventMaybeSTM :: s -> STM (Maybe ResolvedEvent) Source #
Asks for the next incoming event like nextEventMaybe
while still being
in the the STM
.
getSubscriptionDetailsSTM :: s -> STM SubDetails Source #
Returns the runtime details of a subscription.
subscriptionStream :: s -> StreamName Source #
Get subscription stream.
unsubscribe :: s -> IO () Source #
Asynchronously unsubscribe from the the stream.
data SubDropReason Source #
Indicates why a subscription has been dropped.
SubUnsubscribed | Subscription connection has been closed by the user. |
SubAccessDenied | The current user is not allowed to operate on the supplied stream. |
SubNotFound | Given stream name doesn't exist. |
SubPersistDeleted | Given stream is deleted. |
SubAborted | Occurs when the user shutdown the connection from the server or if the connection to the server is no longer possible. |
SubNotAuthenticated (Maybe Text) | |
SubServerError (Maybe Text) | Unexpected error from the server. |
SubNotHandled !NotHandledReason !(Maybe MasterInfo) | |
SubClientError !Text | |
SubSubscriberMaxCountReached |
data SubDetails Source #
Subscription runtime details. Not useful for the user but at least it makes Haddock documentation generation less ugly.
waitConfirmation :: Subscription s => s -> IO () Source #
Waits until the Subscription
has been confirmed.
unsubscribeConfirmed :: Subscription s => s -> IO Bool Source #
Non blocking version of waitUnsubscribeConfirmed
.
unsubscribeConfirmedSTM :: Subscription s => s -> STM Bool Source #
Like unsubscribeConfirmed
but lives in STM
monad.
waitUnsubscribeConfirmed :: Subscription s => s -> IO () Source #
Wait until unsubscription has been confirmed by the server.
nextEventMaybeSTM :: Subscription s => s -> STM (Maybe ResolvedEvent) Source #
Asks for the next incoming event like nextEventMaybe
while still being
in the the STM
.
getSubscriptionDetailsSTM :: Subscription s => s -> STM SubDetails Source #
Returns the runtime details of a subscription.
unsubscribe :: Subscription s => s -> IO () Source #
Asynchronously unsubscribe from the the stream.
subscriptionStream :: Subscription s => s -> StreamName Source #
Get subscription stream.
Volatile Subscription
data RegularSubscription Source #
Also referred as volatile subscription. For example, if a stream has 100 events in it when a subscriber connects, the subscriber can expect to see event number 101 onwards until the time the subscription is closed or dropped.
:: Connection | |
-> StreamName | |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO RegularSubscription |
Subcribes to given stream.
:: Connection | |
-> Bool | Resolve Link Tos |
-> Maybe Credentials | |
-> IO RegularSubscription |
Subcribes to $all stream.
getSubscriptionId :: Subscription s => s -> IO SubscriptionId Source #
Gets the ID of the subscription.
isSubscribedToAll :: Subscription s => s -> Bool Source #
If the subscription is on the $all stream.
nextEvent :: Subscription s => s -> IO ResolvedEvent Source #
Awaits for the next event.
nextEventMaybe :: Subscription s => s -> IO (Maybe ResolvedEvent) Source #
Non blocking version of nextEvent
.
Catch-up Subscription
data CatchupSubscription Source #
This kind of subscription specifies a starting point, in the form of an event number or transaction file position. The given function will be called for events from the starting point until the end of the stream, and then for subsequently written events.
For example, if a starting point of 50 is specified when a stream has 100 events in it, the subscriber can expect to see events 51 through 100, and then any events subsequently written until such time as the subscription is dropped or closed.
:: Connection | |
-> StreamName | |
-> Bool | Resolve Link Tos |
-> Maybe Int64 | Last checkpoint |
-> Maybe Int32 | Batch size |
-> Maybe Credentials | |
-> IO CatchupSubscription |
Subscribes to given stream. If last checkpoint is defined, this will
readStreamEventsForward
from that event number, otherwise from the
beginning. Once last stream event reached up, a subscription request will
be sent using subscribe
.
:: Connection | |
-> Bool | Resolve Link Tos |
-> Maybe Position | Last checkpoint |
-> Maybe Int32 | Batch size |
-> Maybe Credentials | |
-> IO CatchupSubscription |
Same as subscribeFrom
but applied to $all stream.
waitTillCatchup :: CatchupSubscription -> IO () Source #
Waits until CatchupSubscription
subscription catch-up its stream.
hasCaughtUp :: CatchupSubscription -> IO Bool Source #
Non blocking version of waitTillCatchup
.
hasCaughtUpSTM :: CatchupSubscription -> STM Bool Source #
Like hasCaughtUp
but lives in STM
monad.
Persistent Subscription
data PersistentSubscription Source #
The server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. (Need EventStore >= v3.1.0).
data PersistentSubscriptionSettings Source #
Gathers every persistent subscription property.
PersistentSubscriptionSettings | |
|
data SystemConsumerStrategy Source #
System supported consumer strategies for use with persistent subscriptions.
DispatchToSingle | Distributes events to a single client until it is full. Then round robin to the next client. |
RoundRobin | Distributes events to each client in a round robin fashion. |
Gathers every possible Nak actions.
data PersistActionException Source #
Enumerates all persistent action exceptions.
PersistActionFail | The action failed. |
PersistActionAlreadyExist | Happens when creating a persistent subscription on a stream with a group name already taken. |
PersistActionDoesNotExist | An operation tried to do something on a persistent subscription or a stream that don't exist. |
PersistActionAccessDenied | The current user is not allowed to operate on the supplied stream or persistent subscription. |
PersistActionAborted | That action has been aborted because the user shutdown the connection to the server or the connection to the server is no longer possible. |
acknowledge :: PersistentSubscription -> ResolvedEvent -> IO () Source #
Acknowledges that ResolvedEvent
has been successfully processed.
acknowledgeEvents :: PersistentSubscription -> [ResolvedEvent] -> IO () Source #
Acknowledges those ResolvedEvent
s have been successfully processed.
failed :: PersistentSubscription -> ResolvedEvent -> NakAction -> Maybe Text -> IO () Source #
Mark a message that has failed processing. The server will take action based upon the action parameter.
eventsFailed :: PersistentSubscription -> [ResolvedEvent] -> NakAction -> Maybe Text -> IO () Source #
Mark messages that have failed processing. The server will take action based upon the action parameter.
notifyEventsProcessed :: PersistentSubscription -> [UUID] -> IO () Source #
Acknowledges those event ids have been successfully processed.
notifyEventsFailed :: PersistentSubscription -> NakAction -> Maybe Text -> [UUID] -> IO () Source #
Acknowledges those event ids have failed to be processed successfully.
defaultPersistentSubscriptionSettings :: PersistentSubscriptionSettings Source #
System default persistent subscription settings.
createPersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #
Asynchronously create a persistent subscription group on a stream.
updatePersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #
Asynchronously update a persistent subscription group on a stream.
deletePersistentSubscription :: Connection -> Text -> StreamName -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #
Asynchronously delete a persistent subscription group on a stream.
connectToPersistentSubscription :: Connection -> Text -> StreamName -> Int32 -> Maybe Credentials -> IO PersistentSubscription Source #
Asynchronously connect to a persistent subscription given a group on a stream.
Results
Gathers common slice operations.
sliceEvents :: a -> [ResolvedEvent] Source #
Gets slice's ResolvedEvent
s.
sliceDirection :: a -> ReadDirection Source #
Gets slice's reading direction.
sliceEOS :: a -> Bool Source #
If the slice reaches the end of the stream.
sliceFrom :: a -> Loc a Source #
Gets the starting location of this slice.
sliceNext :: a -> Loc a Source #
Gets the next location of this slice.
toSlice :: a -> SomeSlice Source #
Returns a common view of a slice.
Represents a slice of the $all stream.
newtype DeleteResult Source #
Returned after deleting a stream. Position
of the write.
data WriteResult Source #
Returned after writing to a stream.
WriteResult | |
|
data ReadResult :: StreamType -> * -> * where Source #
Enumeration detailing the possible outcomes of reading a stream.
ReadSuccess :: a -> ReadResult t a | |
ReadNoStream :: ReadResult RegularStream a | |
ReadStreamDeleted :: Text -> ReadResult RegularStream a | |
ReadNotModified :: ReadResult t a | |
ReadError :: Maybe Text -> ReadResult t a | |
ReadAccessDenied :: StreamName -> ReadResult t a |
Functor (ReadResult t) Source # | |
Foldable (ReadResult t) Source # | |
Traversable (ReadResult t) Source # | |
Eq a => Eq (ReadResult t a) Source # | |
Show a => Show (ReadResult t a) Source # | |
data RecordedEvent Source #
Represents a previously written event.
RecordedEvent | |
|
Represents the result of looking up a specific event number from a stream.
data StreamType Source #
A stream can either point to $all or a regular one.
data StreamSlice Source #
Regular stream slice.
A structure referring to a potential logical record position in the EventStore transaction file.
Position | |
|
data ReadDirection Source #
Represents the direction of read operation (both from $all an usual streams).
data ResolvedEvent Source #
A structure representing a single event or an resolved link event.
ResolvedEvent | |
|
data OperationError Source #
Operation exception that can occurs on an operation response.
WrongExpectedVersion Text ExpectedVersion | Stream and Expected Version |
StreamDeleted Text | Stream |
InvalidTransaction | |
AccessDenied StreamName | Stream |
InvalidServerResponse Command Command | Expected, Found |
ProtobufDecodingError String | |
ServerError (Maybe Text) | Reason |
InvalidOperation Text | |
StreamNotFound Text | |
NotAuthenticatedOp | Invalid operation state. If happens, it's a driver bug. |
Aborted | Occurs when the user asked to close the connection or if the connection can't reconnect anymore. |
data StreamName Source #
Represents a regular stream name or $all stream.
isEventResolvedLink :: ResolvedEvent -> Bool Source #
Indicates whether this ResolvedEvent
is a resolved link event.
resolvedEventOriginal :: ResolvedEvent -> RecordedEvent Source #
Returns the event that was read or which triggered the subscription.
If this ResolvedEvent
represents a link event, the link will be the
original event, otherwise it will be the event.
resolvedEventDataAsJson :: FromJSON a => ResolvedEvent -> Maybe a Source #
Tries to desarialize resolvedEventOriginal
data as JSON.
resolvedEventOriginalStreamId :: ResolvedEvent -> Text Source #
The stream name of the original event.
resolvedEventOriginalId :: ResolvedEvent -> UUID Source #
The ID of the original event.
resolvedEventOriginalEventNumber :: ResolvedEvent -> Int64 Source #
The event number of the original event.
recordedEventDataAsJson :: FromJSON a => RecordedEvent -> Maybe a Source #
Tries to parse JSON object from the given RecordedEvent
.
positionStart :: Position Source #
Representing the start of the transaction file.
positionEnd :: Position Source #
Representing the end of the transaction file.
Logging
Logger Type.
LogNone | No logging. |
LogStdout BufSize | Logging to stdout.
|
LogStderr BufSize | Logging to stderr.
|
LogFileNoRotate FilePath BufSize | Logging to a file.
|
LogFile FileLogSpec BufSize | Logging to a file.
|
LogCallback (LogStr -> IO ()) (IO ()) | Logging with a log and flush action. run flush after log each message. |
data LoggerFilter Source #
LoggerFilter (LogSource -> LogLevel -> Bool) | |
LoggerLevel LogLevel |
Misc
Internal command representation.
data DropReason Source #
Represents the reason subscription drop happened.
data ExpectedVersion Source #
Constants used for expected version control.
The use of expected version can be a bit tricky especially when discussing idempotency assurances given by the EventStore.
The EventStore will assure idempotency for all operations using any value
in ExpectedVersion
except for anyStream
. When using anyStream
the
EventStore will do its best to assure idempotency but will not guarantee
idempotency.
anyVersion :: ExpectedVersion Source #
This write should not conflict with anything and should always succeed.
noStreamVersion :: ExpectedVersion Source #
The stream being written to should not yet exist. If it does exist treat that as a concurrency problem.
emptyStreamVersion :: ExpectedVersion Source #
The stream should exist and should be empty. If it does not exist or is not empty, treat that as a concurrency problem.
exactEventVersion :: Int64 -> ExpectedVersion Source #
States that the last event written to the stream should have a sequence number matching your expected value.
streamExists :: ExpectedVersion Source #
The stream should exist. If it or a metadata stream does not exist treat that as a concurrency problem.
msDiffTime :: Float -> NominalDiffTime Source #
Millisecond timespan
Re-export
Non-empty (and non-strict) list type.
Since: 4.9.0.0
a :| [a] infixr 5 |
data TLSSettings :: * #
TLS Settings that can be either expressed as simple settings, or as full blown TLS.Params settings.
Unless you need access to parameters that are not accessible through the simple settings, you should use TLSSettingsSimple.
data NominalDiffTime :: * #
This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
Enum NominalDiffTime | |
Eq NominalDiffTime | |
Fractional NominalDiffTime | |
Data NominalDiffTime | |
Num NominalDiffTime | |
Ord NominalDiffTime | |
Real NominalDiffTime | |
RealFrac NominalDiffTime | |
Show NominalDiffTime | |
ToJSON NominalDiffTime | |
FromJSON NominalDiffTime | WARNING: Only parse lengths of time from trusted input
since an attacker could easily fill up the memory of the target
system by specifying a scientific number with a big exponent like
|
NFData NominalDiffTime | |