-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | EventStore TCP Client
--
-- EventStore TCP Client https://eventstore.org
@package eventstore
@version 1.3.2
module Database.EventStore
-- | Represents a connection to a single EventStore node.
data Connection
-- | Gathers every connection type handled by the client.
data ConnectionType
-- | HostName and Port.
Static :: String -> Int -> ConnectionType
Cluster :: ClusterSettings -> ConnectionType
-- | Domain name, optional DNS server and port.
Dns :: ByteString -> Maybe DnsServer -> Int -> ConnectionType
-- | Holds login and password information.
data Credentials
-- | Global Connection settings
data Settings
Settings :: NominalDiffTime -> NominalDiffTime -> Bool -> Retry -> NominalDiffTime -> Maybe TLSSettings -> LogType -> LoggerFilter -> Bool -> NominalDiffTime -> Retry -> Maybe Store -> Maybe Text -> Maybe Credentials -> Settings
-- | Maximum delay of inactivity before the client sends a heartbeat
-- request.
[s_heartbeatInterval] :: Settings -> NominalDiffTime
-- | Maximum delay the server has to issue a heartbeat response.
[s_heartbeatTimeout] :: Settings -> NominalDiffTime
-- | On a cluster settings. Requires the master node when performing a
-- write operation.
[s_requireMaster] :: Settings -> Bool
-- | Retry strategy when failing to connect.
[s_retry] :: Settings -> Retry
-- | Delay before issuing a new connection request.
[s_reconnect_delay] :: Settings -> NominalDiffTime
-- | SSL settings.
[s_ssl] :: Settings -> Maybe TLSSettings
-- | Type of logging to use.
[s_loggerType] :: Settings -> LogType
-- | Restriction of what would be logged.
[s_loggerFilter] :: Settings -> LoggerFilter
-- | Detailed logging output. Currently, it also indicates the location
-- where the log occurred.
[s_loggerDetailed] :: Settings -> Bool
-- | Delay in which an operation will be retried if no response arrived.
[s_operationTimeout] :: Settings -> NominalDiffTime
-- | Retry strategy when an operation timeout.
[s_operationRetry] :: Settings -> Retry
-- | EKG metric store.
[s_monitoring] :: Settings -> Maybe Store
-- | Default connection name.
[s_defaultConnectionName] :: Settings -> Maybe Text
-- | Credentials to use for operations where other
-- Credentials are not explicitly supplied.
[s_defaultUserCredentials] :: Settings -> Maybe Credentials
-- | Represents reconnection strategy.
data Retry
-- | Indicates how many times we should try to reconnect to the server. A
-- value less than or equal to 0 means no retry.
atMost :: Int -> Retry
-- | Indicates we should try to reconnect to the server until the end of
-- the Universe.
keepRetrying :: Retry
-- | Creates a Credentials given a login and a password.
credentials :: ByteString -> ByteString -> Credentials
-- | Default global settings.
--
--
defaultSettings :: Settings
-- | Default SSL settings based on defaultSettings.
defaultSSLSettings :: TLSSettings -> Settings
-- | 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.
connect :: Settings -> ConnectionType -> IO Connection
-- | Asynchronously closes the Connection.
shutdown :: Connection -> IO ()
-- | Waits the Connection to be closed.
waitTillClosed :: Connection -> IO ()
-- | Returns a Connection 's Settings.
connectionSettings :: Connection -> Settings
-- | Contains settings related to a connection to a cluster.
data ClusterSettings
ClusterSettings :: !ByteString -> !Int -> !Int -> Maybe (NonEmpty GossipSeed) -> !TimeSpan -> !Maybe DnsServer -> ClusterSettings
-- | The DNS name to use for discovering endpoints.
[clusterDns] :: ClusterSettings -> !ByteString
-- | The maximum number of attempts for discovering endpoints.
[clusterMaxDiscoverAttempts] :: ClusterSettings -> !Int
-- | The well-known endpoint on which cluster managers are running.
[clusterExternalGossipPort] :: ClusterSettings -> !Int
-- | Endpoints for seeding gossip if not using DNS.
[clusterGossipSeeds] :: ClusterSettings -> Maybe (NonEmpty GossipSeed)
-- | Timeout for cluster gossip.
[clusterGossipTimeout] :: ClusterSettings -> !TimeSpan
-- | Indicates a specific DNS server should be contacted.
[clusterDnsServer] :: ClusterSettings -> !Maybe DnsServer
-- | Tells how the DNS server should be contacted.
data DnsServer
DnsFilePath :: String -> DnsServer
DnsHostName :: String -> DnsServer
DnsHostPort :: String -> Int -> DnsServer
-- | Represents a source of cluster gossip.
data GossipSeed
-- | Creates a GossipSeed.
gossipSeed :: String -> Int -> GossipSeed
-- | Creates a GossipSeed with a specific HTTP header.
gossipSeedWithHeader :: String -> Int -> String -> GossipSeed
-- | Returns GossipSeed host IP address.
gossipSeedHost :: GossipSeed -> String
-- | The host header to be sent when requesting gossip.
gossipSeedHeader :: GossipSeed -> String
-- | Returns GossipSeed port.
gossipSeedPort :: GossipSeed -> Int
-- | Configures a ClusterSettings for connecting to a cluster using
-- gossip seeds. clusterDns = "" clusterMaxDiscoverAttempts = 10
-- clusterExternalGossipPort = 0 clusterGossipTimeout = 1s
gossipSeedClusterSettings :: NonEmpty GossipSeed -> ClusterSettings
-- | Configures a ClusterSettings for connecting to a cluster using
-- DNS discovery. clusterMaxDiscoverAttempts = 10
-- clusterExternalGossipPort = 0 clusterGossipSeeds = Nothing
-- clusterGossipTimeout = 1s
dnsClusterSettings :: ByteString -> ClusterSettings
-- | Contains event information like its type and data. Only used for write
-- queries.
data Event
-- | Holds event data.
data EventData
-- | Constants for System event types.
data EventType
-- | Event type for stream deleted.
StreamDeletedType :: EventType
-- | Event type for statistics.
StatsCollectionType :: EventType
-- | Event type for linkTo.
LinkToType :: EventType
-- | Event type for stream metadata.
StreamMetadataType :: EventType
-- | Event type for the system settings.
SettingsType :: EventType
-- | Event defined by the user.
UserDefined :: Text -> EventType
-- | Create an Event meant to be persisted.
createEvent :: EventType -> Maybe UUID -> EventData -> Event
-- | Creates an event using JSON format
withJson :: ToJSON a => a -> EventData
-- | Creates an event with metadata using JSON format.
withJsonAndMetadata :: (ToJSON a, ToJSON b) => a -> b -> EventData
-- | Creates an event using a binary format.
withBinary :: ByteString -> EventData
-- | Creates an event with metadata using binary format.
withBinaryAndMetadata :: ByteString -> ByteString -> EventData
-- | Represents an event position within a stream.
data EventNumber
-- | The first event in a stream.
streamStart :: EventNumber
-- | The last event in the stream.
streamEnd :: EventNumber
-- | the Nth event of a stream.
eventNumber :: Natural -> EventNumber
-- | Returns a 'EventNumber from a raw Int64.
rawEventNumber :: Int64 -> EventNumber
-- | Returns a raw Int64 from an EventNumber.
eventNumberToInt64 :: EventNumber -> Int64
-- | Occurs when an operation has been retried more than
-- s_operationRetry.
data OperationMaxAttemptReached
OperationMaxAttemptReached :: UUID -> Command -> OperationMaxAttemptReached
-- | Represents stream metadata as a series of properties for system data
-- and a StreamMetadata object for user metadata.
data StreamMetadataResult
StreamMetadataResult :: !Text -> !Int64 -> !StreamMetadata -> StreamMetadataResult
-- | The name of the stream.
[streamMetaResultStream] :: StreamMetadataResult -> !Text
-- | The version of the metadata format.
[streamMetaResultVersion] :: StreamMetadataResult -> !Int64
-- | A StreamMetadata containing user-specified metadata.
[streamMetaResultData] :: StreamMetadataResult -> !StreamMetadata
-- | When the stream is either not found or 'no stream'.
NotFoundStreamMetadataResult :: !Text -> StreamMetadataResult
-- | The name of the stream.
[streamMetaResultStream] :: StreamMetadataResult -> !Text
-- | When the stream is soft-deleted.
DeletedStreamMetadataResult :: !Text -> StreamMetadataResult
-- | The name of the stream.
[streamMetaResultStream] :: StreamMetadataResult -> !Text
-- | When batch-reading a stream, this type-level function maps the result
-- you will have whether you read a regular stream or $all stream. When
-- reading a regular stream, some read-error can occur like the stream
-- got deleted. However read-error cannot occur when reading $all stream
-- (because $all cannot get deleted).
type family BatchResult t
-- | Determines whether any link event encountered in the stream will be
-- resolved. See the discussion for more information:
-- https://eventstore.org/docs/dotnet-api/reading-events/index.html#resolvedevent
data ResolveLink
ResolveLink :: ResolveLink
NoResolveLink :: ResolveLink
-- | Reads a single event from given stream.
readEvent :: Connection -> StreamName -> EventNumber -> ResolveLink -> Maybe Credentials -> IO (Async (ReadResult EventNumber ReadEvent))
-- | Reads events from a stream backward.
readEventsBackward :: Connection -> StreamId t -> t -> Int32 -> ResolveLink -> Maybe Credentials -> IO (Async (BatchResult t))
-- | Reads events from a stream forward.
readEventsForward :: Connection -> StreamId t -> t -> Int32 -> ResolveLink -> Maybe Credentials -> IO (Async (BatchResult t))
-- | Asynchronously gets the metadata of a stream.
getStreamMetadata :: Connection -> StreamName -> Maybe Credentials -> IO (Async StreamMetadataResult)
-- | Represents an access control list for a stream.
data StreamACL
StreamACL :: !Maybe [Text] -> !Maybe [Text] -> !Maybe [Text] -> !Maybe [Text] -> !Maybe [Text] -> StreamACL
-- | Roles and users permitted to read the stream.
[streamACLReadRoles] :: StreamACL -> !Maybe [Text]
-- | Roles and users permitted to write to the stream.
[streamACLWriteRoles] :: StreamACL -> !Maybe [Text]
-- | Roles and users permitted to delete to the stream.
[streamACLDeleteRoles] :: StreamACL -> !Maybe [Text]
-- | Roles and users permitted to read stream metadata.
[streamACLMetaReadRoles] :: StreamACL -> !Maybe [Text]
-- | Roles and users permitted to write stream metadata.
[streamACLMetaWriteRoles] :: StreamACL -> !Maybe [Text]
-- | Represents stream metadata with strongly typed properties for system
-- values and a dictionary-like interface for custom values.
data StreamMetadata
StreamMetadata :: !Maybe Int32 -> !Maybe TimeSpan -> !Maybe Int32 -> !Maybe TimeSpan -> !Maybe StreamACL -> !Object -> StreamMetadata
-- | The maximum number of events allowed in the stream.
[streamMetadataMaxCount] :: StreamMetadata -> !Maybe Int32
-- | The maximum age of events allowed in the stream.
[streamMetadataMaxAge] :: StreamMetadata -> !Maybe TimeSpan
-- | The event number from which previous events can be scavenged. This is
-- used to implement soft-deletion of streams.
[streamMetadataTruncateBefore] :: StreamMetadata -> !Maybe Int32
-- | The amount of time for which the stream head is cachable.
[streamMetadataCacheControl] :: StreamMetadata -> !Maybe TimeSpan
-- | The access control list for the stream.
[streamMetadataACL] :: StreamMetadata -> !Maybe StreamACL
-- | An enumerable of key-value pairs of keys to JSON text for
-- user-provider metadata.
[streamMetadataCustom] :: StreamMetadata -> !Object
-- | Gets a custom property value from metadata.
getCustomPropertyValue :: StreamMetadata -> Text -> Maybe Value
-- | Get a custom property value from metadata.
getCustomProperty :: FromJSON a => StreamMetadata -> Text -> Maybe a
-- | StreamACL with no role or users whatsoever.
emptyStreamACL :: StreamACL
-- | StreamMetadata with everything set to Nothing, using
-- emptyStreamACL and an empty Object.
emptyStreamMetadata :: StreamMetadata
-- | Deletes given stream.
deleteStream :: Connection -> StreamName -> ExpectedVersion -> Maybe Bool -> Maybe Credentials -> IO (Async DeleteResult)
-- | Sends a single Event to given stream.
sendEvent :: Connection -> StreamName -> ExpectedVersion -> Event -> Maybe Credentials -> IO (Async WriteResult)
-- | Sends a list of Event to given stream.
sendEvents :: Connection -> StreamName -> ExpectedVersion -> [Event] -> Maybe Credentials -> IO (Async WriteResult)
-- | Asynchronously sets the metadata for a stream.
setStreamMetadata :: Connection -> StreamName -> ExpectedVersion -> StreamMetadata -> Maybe Credentials -> IO (Async WriteResult)
-- | Allows to build a structure using Monoid functions.
type Builder a = Endo a
-- | A Builder applies to StreamACL.
type StreamACLBuilder = Builder StreamACL
-- | Builds a StreamACL from a StreamACLBuilder.
buildStreamACL :: StreamACLBuilder -> StreamACL
-- | Modifies a StreamACL using a StreamACLBuilder.
modifyStreamACL :: StreamACLBuilder -> StreamACL -> StreamACL
-- | Sets role names with read permission for the stream.
setReadRoles :: [Text] -> StreamACLBuilder
-- | Sets a single role name with read permission for the stream.
setReadRole :: Text -> StreamACLBuilder
-- | Sets role names with write permission for the stream.
setWriteRoles :: [Text] -> StreamACLBuilder
-- | Sets a single role name with write permission for the stream.
setWriteRole :: Text -> StreamACLBuilder
-- | Sets role names with delete permission for the stream.
setDeleteRoles :: [Text] -> StreamACLBuilder
-- | Sets a single role name with delete permission for the stream.
setDeleteRole :: Text -> StreamACLBuilder
-- | Sets role names with metadata read permission for the stream.
setMetaReadRoles :: [Text] -> StreamACLBuilder
-- | Sets a single role name with metadata read permission for the stream.
setMetaReadRole :: Text -> StreamACLBuilder
-- | Sets role names with metadata write permission for the stream.
setMetaWriteRoles :: [Text] -> StreamACLBuilder
-- | Sets a single role name with metadata write permission for the stream.
setMetaWriteRole :: Text -> StreamACLBuilder
-- | A Builder applies to StreamMetadata.
type StreamMetadataBuilder = Builder StreamMetadata
-- | Builds a StreamMetadata from a StreamMetadataBuilder.
buildStreamMetadata :: StreamMetadataBuilder -> StreamMetadata
-- | Modifies a StreamMetadata using a StreamMetadataBuilder
modifyStreamMetadata :: StreamMetadataBuilder -> StreamMetadata -> StreamMetadata
-- | Sets the maximum number of events allowed in the stream.
setMaxCount :: Int32 -> StreamMetadataBuilder
-- | Sets the maximum age of events allowed in the stream.
setMaxAge :: TimeSpan -> StreamMetadataBuilder
-- | Sets the event number from which previous events can be scavenged.
setTruncateBefore :: Int32 -> StreamMetadataBuilder
-- | Sets the amount of time for which the stream head is cachable.
setCacheControl :: TimeSpan -> StreamMetadataBuilder
-- | Overwrites any previous StreamACL by the given one in a
-- StreamMetadataBuilder.
setACL :: StreamACL -> StreamMetadataBuilder
-- | Updates a StreamMetadata's StreamACL given a
-- StreamACLBuilder.
modifyACL :: StreamACLBuilder -> StreamMetadataBuilder
-- | Sets a custom metadata property.
setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder
-- | Represents a multi-request transaction with the EventStore.
data Transaction
-- | The id of a Transaction.
data TransactionId
-- | Starts a transaction on given stream.
startTransaction :: Connection -> StreamName -> ExpectedVersion -> Maybe Credentials -> IO (Async Transaction)
-- | Gets the id of a Transaction.
transactionId :: Transaction -> TransactionId
-- | Asynchronously commits this transaction.
transactionCommit :: Transaction -> Maybe Credentials -> IO (Async WriteResult)
-- | There isn't such of thing in EventStore parlance. Basically, if you
-- want to rollback, you just have to not transactionCommit a
-- Transaction.
transactionRollback :: Transaction -> IO ()
-- | Asynchronously writes to a transaction in the EventStore.
transactionWrite :: Transaction -> [Event] -> Maybe Credentials -> IO (Async ())
data SubscriptionClosed
SubscriptionClosed :: Maybe SubDropReason -> SubscriptionClosed
-- | Represents a subscription id.
data SubscriptionId
-- | Returns the stream of a subscription.
class SubscriptionStream s t | t -> s
subscriptionStream :: SubscriptionStream s t => s -> StreamId t
-- | Common operations supported by a subscription.
class Subscription s
-- | Indicates why a subscription has been dropped.
data SubDropReason
-- | Subscription connection has been closed by the user.
SubUnsubscribed :: SubDropReason
-- | The current user is not allowed to operate on the supplied stream.
SubAccessDenied :: SubDropReason
-- | Given stream name doesn't exist.
SubNotFound :: SubDropReason
-- | Given stream is deleted.
SubPersistDeleted :: SubDropReason
-- | Occurs when the user shutdown the connection from the server or if the
-- connection to the server is no longer possible.
SubAborted :: SubDropReason
SubNotAuthenticated :: Maybe Text -> SubDropReason
-- | Unexpected error from the server.
SubServerError :: Maybe Text -> SubDropReason
SubNotHandled :: !NotHandledReason -> !Maybe MasterInfo -> SubDropReason
SubClientError :: !Text -> SubDropReason
SubSubscriberMaxCountReached :: SubDropReason
-- | Subscription runtime details. Not useful for the user but at least it
-- makes Haddock documentation generation less ugly.
data SubDetails
-- | Waits until the Subscription has been confirmed.
waitConfirmation :: Subscription s => s -> IO ()
-- | Non blocking version of waitUnsubscribeConfirmed.
unsubscribeConfirmed :: Subscription s => s -> IO Bool
-- | Like unsubscribeConfirmed but lives in STM monad.
unsubscribeConfirmedSTM :: Subscription s => s -> STM Bool
-- | Wait until unsubscription has been confirmed by the server.
waitUnsubscribeConfirmed :: Subscription s => s -> IO ()
-- | Asks for the next incoming event like nextEventMaybe while
-- still being in the the STM.
nextEventMaybeSTM :: Subscription s => s -> STM (Maybe ResolvedEvent)
-- | Returns the runtime details of a subscription.
getSubscriptionDetailsSTM :: Subscription s => s -> STM SubDetails
-- | Asynchronously unsubscribe from the the stream.
unsubscribe :: Subscription s => s -> IO ()
-- | 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.
data RegularSubscription t
-- | Subscribes to a stream.
subscribe :: Connection -> StreamId t -> ResolveLink -> Maybe Credentials -> IO (RegularSubscription t)
-- | Gets the ID of the subscription.
getSubscriptionId :: Subscription s => s -> IO SubscriptionId
-- | Awaits for the next event.
nextEvent :: Subscription s => s -> IO ResolvedEvent
-- | Non blocking version of nextEvent.
nextEventMaybe :: Subscription s => s -> IO (Maybe ResolvedEvent)
-- | 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.
data CatchupSubscription t
-- | Subscribes to a 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.
subscribeFrom :: Connection -> StreamId t -> ResolveLink -> Maybe t -> Maybe Int32 -> Maybe Credentials -> IO (CatchupSubscription t)
-- | Waits until CatchupSubscription subscription catch-up its
-- stream.
waitTillCatchup :: CatchupSubscription t -> IO ()
-- | Non blocking version of waitTillCatchup.
hasCaughtUp :: CatchupSubscription t -> IO Bool
-- | Like hasCaughtUp but lives in STM monad.
hasCaughtUpSTM :: CatchupSubscription t -> STM Bool
-- | 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 PersistentSubscription
-- | Gathers every persistent subscription property.
data PersistentSubscriptionSettings
PersistentSubscriptionSettings :: !Bool -> !Int64 -> !Bool -> !TimeSpan -> !Int32 -> !Int32 -> !Int32 -> !Int32 -> !TimeSpan -> !Int32 -> !Int32 -> !Int32 -> !SystemConsumerStrategy -> PersistentSubscriptionSettings
-- | Whether or not the persistent subscription should resolve linkTo
-- events to their linked events.
[psSettingsResolveLinkTos] :: PersistentSubscriptionSettings -> !Bool
-- | Where the subscription should start from (position).
[psSettingsStartFrom] :: PersistentSubscriptionSettings -> !Int64
-- | Whether or not in depth latency statistics should be tracked on this
-- subscription.
[psSettingsExtraStats] :: PersistentSubscriptionSettings -> !Bool
-- | The amount of time after which a message should be considered to be
-- timeout and retried.
[psSettingsMsgTimeout] :: PersistentSubscriptionSettings -> !TimeSpan
-- | The maximum number of retries (due to timeout) before a message get
-- considered to be parked.
[psSettingsMaxRetryCount] :: PersistentSubscriptionSettings -> !Int32
-- | The size of the buffer listening to live messages as they happen.
[psSettingsLiveBufSize] :: PersistentSubscriptionSettings -> !Int32
-- | The number of events read at a time when paging in history.
[psSettingsReadBatchSize] :: PersistentSubscriptionSettings -> !Int32
-- | The number of events to cache when paging through history.
[psSettingsHistoryBufSize] :: PersistentSubscriptionSettings -> !Int32
-- | The amount of time to try checkpoint after.
[psSettingsCheckPointAfter] :: PersistentSubscriptionSettings -> !TimeSpan
-- | The minimum number of messages to checkpoint.
[psSettingsMinCheckPointCount] :: PersistentSubscriptionSettings -> !Int32
-- | The maximum number of message to checkpoint. If this number is
-- reached, a checkpoint will be forced.
[psSettingsMaxCheckPointCount] :: PersistentSubscriptionSettings -> !Int32
-- | The maximum number of subscribers allowed.
[psSettingsMaxSubsCount] :: PersistentSubscriptionSettings -> !Int32
-- | The strategy to use for distributing events to client consumers.
[psSettingsNamedConsumerStrategy] :: PersistentSubscriptionSettings -> !SystemConsumerStrategy
-- | System supported consumer strategies for use with persistent
-- subscriptions.
data SystemConsumerStrategy
-- | Distributes events to a single client until it is full. Then round
-- robin to the next client.
DispatchToSingle :: SystemConsumerStrategy
-- | Distributes events to each client in a round robin fashion.
RoundRobin :: SystemConsumerStrategy
-- | Gathers every possible Nak actions.
data NakAction
NA_Unknown :: NakAction
NA_Park :: NakAction
NA_Retry :: NakAction
NA_Skip :: NakAction
NA_Stop :: NakAction
-- | Enumerates all persistent action exceptions.
data PersistActionException
-- | The action failed.
PersistActionFail :: PersistActionException
-- | Happens when creating a persistent subscription on a stream with a
-- group name already taken.
PersistActionAlreadyExist :: PersistActionException
-- | An operation tried to do something on a persistent subscription or a
-- stream that don't exist.
PersistActionDoesNotExist :: PersistActionException
-- | The current user is not allowed to operate on the supplied stream or
-- persistent subscription.
PersistActionAccessDenied :: PersistActionException
-- | That action has been aborted because the user shutdown the connection
-- to the server or the connection to the server is no longer possible.
PersistActionAborted :: PersistActionException
-- | Acknowledges that ResolvedEvent has been successfully
-- processed.
acknowledge :: PersistentSubscription -> ResolvedEvent -> IO ()
-- | Acknowledges those ResolvedEvents have been successfully
-- processed.
acknowledgeEvents :: PersistentSubscription -> [ResolvedEvent] -> IO ()
-- | Mark a message that has failed processing. The server will take action
-- based upon the action parameter.
failed :: PersistentSubscription -> ResolvedEvent -> NakAction -> Maybe Text -> IO ()
-- | Mark messages that have failed processing. The server will take action
-- based upon the action parameter.
eventsFailed :: PersistentSubscription -> [ResolvedEvent] -> NakAction -> Maybe Text -> IO ()
-- | Acknowledges those event ids have been successfully processed.
notifyEventsProcessed :: PersistentSubscription -> [UUID] -> IO ()
-- | Acknowledges those event ids have failed to be processed successfully.
notifyEventsFailed :: PersistentSubscription -> NakAction -> Maybe Text -> [UUID] -> IO ()
-- | System default persistent subscription settings.
defaultPersistentSubscriptionSettings :: PersistentSubscriptionSettings
-- | Asynchronously create a persistent subscription group on a stream.
createPersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
-- | Asynchronously update a persistent subscription group on a stream.
updatePersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
-- | Asynchronously delete a persistent subscription group on a stream.
deletePersistentSubscription :: Connection -> Text -> StreamName -> Maybe Credentials -> IO (Async (Maybe PersistActionException))
-- | Asynchronously connect to a persistent subscription given a group on a
-- stream.
connectToPersistentSubscription :: Connection -> Text -> StreamName -> Int32 -> Maybe Credentials -> IO PersistentSubscription
-- | Gathers common slice operations.
data Slice t
SliceEndOfStream :: Slice t
Slice :: ![ResolvedEvent] -> !Maybe t -> Slice t
-- | Gets slice's ResolvedEventss.
sliceEvents :: Slice t -> [ResolvedEvent]
-- | If the slice has reached the end of the stream.
sliceEOS :: Slice t -> Bool
-- | Gets the next location of this slice.
sliceNext :: Slice t -> Maybe t
-- | Empty slice.
emptySlice :: Slice t
-- | Represents a slice of the $all stream.
type AllSlice = Slice Position
-- | Returned after deleting a stream. Position of the write.
newtype DeleteResult
DeleteResult :: Position -> DeleteResult
-- | Returned after writing to a stream.
data WriteResult
WriteResult :: !Int64 -> !Position -> WriteResult
-- | Next expected version of the stream.
[writeNextExpectedVersion] :: WriteResult -> !Int64
-- | Position of the write.
[writePosition] :: WriteResult -> !Position
-- | Enumeration detailing the possible outcomes of reading a stream.
data ReadResult t a
[ReadSuccess] :: a -> ReadResult t a
[ReadNoStream] :: ReadResult EventNumber a
[ReadStreamDeleted] :: StreamName -> ReadResult EventNumber a
[ReadNotModified] :: ReadResult t a
[ReadError] :: Maybe Text -> ReadResult t a
[ReadAccessDenied] :: StreamId t -> ReadResult t a
-- | Represents a previously written event.
data RecordedEvent
RecordedEvent :: !Text -> !UUID -> !Int64 -> !Text -> !ByteString -> !Maybe ByteString -> !Bool -> !Maybe UTCTime -> RecordedEvent
-- | The event stream that this event belongs to.
[recordedEventStreamId] :: RecordedEvent -> !Text
-- | Unique identifier representing this event.
[recordedEventId] :: RecordedEvent -> !UUID
-- | Number of this event in the stream.
[recordedEventNumber] :: RecordedEvent -> !Int64
-- | Type of this event.
[recordedEventType] :: RecordedEvent -> !Text
-- | Representing the data of this event.
[recordedEventData] :: RecordedEvent -> !ByteString
-- | Representing the metadada associated with this event.
[recordedEventMetadata] :: RecordedEvent -> !Maybe ByteString
-- | Indicates whether the content is internally marked as json.
[recordedEventIsJson] :: RecordedEvent -> !Bool
-- | Representing when this event was created in the system.
[recordedEventCreated] :: RecordedEvent -> !Maybe UTCTime
-- | Represents the result of looking up a specific event number from a
-- stream.
data ReadEvent
ReadEventNotFound :: !Text -> !Int64 -> ReadEvent
[readEventStream] :: ReadEvent -> !Text
[readEventNumber] :: ReadEvent -> !Int64
ReadEvent :: !Text -> !Int64 -> !ResolvedEvent -> ReadEvent
[readEventStream] :: ReadEvent -> !Text
[readEventNumber] :: ReadEvent -> !Int64
[readEventResolved] :: ReadEvent -> !ResolvedEvent
-- | Regular stream slice.
type StreamSlice = Slice EventNumber
-- | A structure referring to a potential logical record position in the
-- EventStore transaction file.
data Position
Position :: !Int64 -> !Int64 -> Position
-- | Commit position of the record
[positionCommit] :: Position -> !Int64
-- | Prepare position of the record
[positionPrepare] :: Position -> !Int64
-- | Represents the direction of read operation (both from $all an usual
-- streams).
data ReadDirection
-- | From beginning to end
Forward :: ReadDirection
-- | From end to beginning
Backward :: ReadDirection
-- | A structure representing a single event or an resolved link event.
data ResolvedEvent
ResolvedEvent :: !Maybe RecordedEvent -> !Maybe RecordedEvent -> !Maybe Position -> ResolvedEvent
-- | The event, or the resolved link event if this ResolvedEvent is
-- a link event.
[resolvedEventRecord] :: ResolvedEvent -> !Maybe RecordedEvent
-- | The link event if this ResolvedEvent is a link event.
[resolvedEventLink] :: ResolvedEvent -> !Maybe RecordedEvent
-- | Possible Position of that event.
[resolvedEventPosition] :: ResolvedEvent -> !Maybe Position
-- | Operation exception that can occurs on an operation response.
data OperationError
-- | Stream and Expected Version
WrongExpectedVersion :: Text -> ExpectedVersion -> OperationError
-- | Stream
StreamDeleted :: StreamName -> OperationError
InvalidTransaction :: OperationError
-- | Stream
AccessDenied :: StreamId t -> OperationError
-- | Expected, Found
InvalidServerResponse :: Command -> Command -> OperationError
ProtobufDecodingError :: String -> OperationError
-- | Reason
ServerError :: Maybe Text -> OperationError
InvalidOperation :: Text -> OperationError
StreamNotFound :: StreamName -> OperationError
-- | Invalid operation state. If happens, it's a driver bug.
NotAuthenticatedOp :: OperationError
-- | Occurs when the user asked to close the connection or if the
-- connection can't reconnect anymore.
Aborted :: OperationError
-- | Represents a regular stream name or $all stream.
data StreamId loc
[StreamName] :: Text -> StreamId EventNumber
[All] :: StreamId Position
type StreamName = StreamId EventNumber
-- | If the stream is the $all stream.
isAllStream :: StreamId t -> Bool
-- | Indicates whether this ResolvedEvent is a resolved link event.
isEventResolvedLink :: ResolvedEvent -> Bool
-- | 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.
resolvedEventOriginal :: ResolvedEvent -> RecordedEvent
-- | Tries to desarialize resolvedEventOriginal data as JSON.
resolvedEventDataAsJson :: FromJSON a => ResolvedEvent -> Maybe a
-- | The stream name of the original event.
resolvedEventOriginalStreamId :: ResolvedEvent -> Text
-- | The ID of the original event.
resolvedEventOriginalId :: ResolvedEvent -> UUID
-- | The event number of the original event.
resolvedEventOriginalEventNumber :: ResolvedEvent -> Int64
-- | Tries to parse JSON object from the given RecordedEvent.
recordedEventDataAsJson :: FromJSON a => RecordedEvent -> Maybe a
-- | Representing the start of the transaction file.
positionStart :: Position
-- | Representing the end of the transaction file.
positionEnd :: Position
data LogLevel
LevelDebug :: LogLevel
LevelInfo :: LogLevel
LevelWarn :: LogLevel
LevelError :: LogLevel
LevelOther :: Text -> LogLevel
-- | Logger Type.
data LogType
-- | No logging.
LogNone :: LogType
-- | Logging to stdout. BufSize is a buffer size for each
-- capability.
LogStdout :: BufSize -> LogType
-- | Logging to stderr. BufSize is a buffer size for each
-- capability.
LogStderr :: BufSize -> LogType
-- | Logging to a file. BufSize is a buffer size for each
-- capability.
LogFileNoRotate :: FilePath -> BufSize -> LogType
-- | Logging to a file. BufSize is a buffer size for each
-- capability. File rotation is done on-demand.
LogFile :: FileLogSpec -> BufSize -> LogType
-- | Logging to a file. BufSize is a buffer size for each
-- capability. Rotation happens based on check specified in
-- TimedFileLogSpec.
LogFileTimedRotate :: TimedFileLogSpec -> BufSize -> LogType
-- | Logging with a log and flush action. run flush after log each message.
LogCallback :: (LogStr -> IO ()) -> IO () -> LogType
data LoggerFilter
LoggerFilter :: (LogSource -> LogLevel -> Bool) -> LoggerFilter
LoggerLevel :: LogLevel -> LoggerFilter
-- | Internal command representation.
data Command
-- | Represents the reason subscription drop happened.
data DropReason
D_Unsubscribed :: DropReason
D_AccessDenied :: DropReason
D_NotFound :: DropReason
D_PersistentSubscriptionDeleted :: DropReason
D_SubscriberMaxCountReached :: DropReason
-- | 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.
data ExpectedVersion
-- | This write should not conflict with anything and should always
-- succeed.
anyVersion :: ExpectedVersion
-- | The stream being written to should not yet exist. If it does exist
-- treat that as a concurrency problem.
noStreamVersion :: ExpectedVersion
-- | The stream should exist and should be empty. If it does not exist or
-- is not empty, treat that as a concurrency problem.
emptyStreamVersion :: ExpectedVersion
-- | States that the last event written to the stream should have a
-- sequence number matching your expected value.
exactEventVersion :: Int64 -> ExpectedVersion
-- | The stream should exist. If it or a metadata stream does not exist
-- treat that as a concurrency problem.
streamExists :: ExpectedVersion
-- | Millisecond timespan
msDiffTime :: Float -> NominalDiffTime
-- | An associative operation.
(<>) :: Semigroup a => a -> a -> a
infixr 6 <>
-- | Non-empty (and non-strict) list type.
data NonEmpty a
(:|) :: a -> [a] -> NonEmpty a
infixr 5 :|
-- | nonEmpty efficiently turns a normal list into a NonEmpty
-- stream, producing Nothing if the input is empty.
nonEmpty :: () => [a] -> Maybe (NonEmpty a)
-- | 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 TLSSettings
-- | 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.
data NominalDiffTime
module Database.EventStore.Streaming
data ReadError t
[StreamDeleted] :: StreamName -> ReadError EventNumber
[ReadError] :: Maybe Text -> ReadError t
[AccessDenied] :: StreamId t -> ReadError t
[NoStream] :: ReadError EventNumber
data Fetch t
FetchError :: !ReadError t -> Fetch t
Fetch :: !Slice t -> Fetch t
newtype ReadResultHandler
ReadResultHandler :: (forall t. StreamId t -> BatchResult t -> Fetch t) -> ReadResultHandler
[runReadResultHandler] :: ReadResultHandler -> forall t. StreamId t -> BatchResult t -> Fetch t
-- | Returns an iterator able to consume a stream entirely. When reading
-- forward, the iterator ends when the last stream's event is reached.
readThroughForward :: Connection -> StreamId t -> ResolveLink -> t -> Maybe Int32 -> Maybe Credentials -> Stream (Of ResolvedEvent) (ExceptT (ReadError t) IO) ()
-- | Returns an iterator able to consume a stream entirely. When reading
-- backward, the iterator ends when the first stream's event is reached.
readThroughBackward :: Connection -> StreamId t -> ResolveLink -> t -> Maybe Int32 -> Maybe Credentials -> Stream (Of ResolvedEvent) (ExceptT (ReadError t) IO) ()
-- | Throws an exception in case ExceptT is a Left.
throwOnError :: (Show t, Typeable t) => Stream (Of a) (ExceptT (ReadError t) IO) () -> Stream (Of a) IO ()
defaultReadResultHandler :: ReadResultHandler
onRegularStream :: (ReadResult EventNumber (Slice EventNumber) -> Fetch EventNumber) -> ReadResultHandler
-- | Returns an iterator able to consume a stream entirely.
readThrough :: Connection -> ReadResultHandler -> ReadDirection -> StreamId t -> ResolveLink -> t -> Maybe Int32 -> Maybe Credentials -> Stream (Of ResolvedEvent) (ExceptT (ReadError t) IO) ()
instance GHC.Show.Show (Database.EventStore.Streaming.ReadError t)
instance (GHC.Show.Show t, Data.Typeable.Internal.Typeable t) => GHC.Exception.Type.Exception (Database.EventStore.Streaming.ReadError t)