Copyright | (C) 2019 Yorick Laupa |
---|---|
License | (see the file LICENSE) |
Maintainer | Yorick Laupa <yo.eight@gmail.com> |
Stability | provisional |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- 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 :: MonitoringBackend
- 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 EventNumber
- streamStart :: EventNumber
- streamEnd :: EventNumber
- eventNumber :: Natural -> EventNumber
- rawEventNumber :: Int64 -> EventNumber
- eventNumberToInt64 :: EventNumber -> Int64
- data StreamMetadataResult
- type family BatchResult t where ...
- data ResolveLink
- readEvent :: Connection -> StreamName -> EventNumber -> ResolveLink -> Maybe Credentials -> IO (Async (ReadResult EventNumber ReadEvent))
- readEventsBackward :: Connection -> StreamId t -> t -> Int32 -> ResolveLink -> Maybe Credentials -> IO (Async (BatchResult t))
- readEventsForward :: Connection -> StreamId t -> t -> Int32 -> ResolveLink -> Maybe Credentials -> IO (Async (BatchResult t))
- getStreamMetadata :: Connection -> StreamName -> Maybe Credentials -> IO (Async StreamMetadataResult)
- data StreamACL = StreamACL {
- streamACLReadRoles :: !(Maybe [Text])
- streamACLWriteRoles :: !(Maybe [Text])
- streamACLDeleteRoles :: !(Maybe [Text])
- streamACLMetaReadRoles :: !(Maybe [Text])
- streamACLMetaWriteRoles :: !(Maybe [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)
- class SubscriptionStream s t | t -> s where
- subscriptionStream :: s -> StreamId t
- class Subscription s
- data SubDropReason
- = SubUnsubscribed
- | SubAccessDenied
- | SubNotFound
- | SubPersistDeleted
- | SubAborted
- | SubNotAuthenticated (Maybe Text)
- | SubServerError (Maybe Text)
- | SubNotHandled !NotHandledReason !(Maybe MasterInfo)
- | SubClientError !Text
- | SubSubscriberMaxCountReached
- data SubDetails
- data SubAction
- unsubscribe :: Subscription s => s -> IO ()
- nextSubEvent :: Subscription s => s -> IO SubAction
- streamSubEvents :: Subscription s => s -> Stream (Of SubAction) IO ()
- streamSubResolvedEvents :: Subscription s => s -> Stream (Of ResolvedEvent) IO ()
- data RegularSubscription t
- subscribe :: Connection -> StreamId t -> ResolveLink -> Maybe Credentials -> IO (RegularSubscription t)
- data CatchupSubscription t
- subscribeFrom :: Connection -> StreamId t -> ResolveLink -> Maybe t -> Maybe Int32 -> Maybe Credentials -> IO (CatchupSubscription t)
- 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
- data Slice t
- = SliceEndOfStream
- | Slice ![ResolvedEvent] !(Maybe t)
- sliceEvents :: Slice t -> [ResolvedEvent]
- sliceEOS :: Slice t -> Bool
- sliceNext :: Slice t -> Maybe t
- emptySlice :: Slice t
- type AllSlice = Slice Position
- newtype DeleteResult = DeleteResult Position
- data WriteResult = WriteResult {}
- data ReadResult t a where
- 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
- data RecordedEvent = RecordedEvent {}
- data ReadEvent
- = ReadEventNotFound {
- readEventStream :: !Text
- readEventNumber :: !Int64
- | ReadEvent { }
- = ReadEventNotFound {
- type StreamSlice = Slice EventNumber
- data Position = Position {
- positionCommit :: !Int64
- positionPrepare :: !Int64
- data ReadDirection
- data ResolvedEvent = ResolvedEvent {}
- data OperationError
- = WrongExpectedVersion !Text !ExpectedVersion
- | StreamDeleted !StreamName
- | InvalidTransaction
- | AccessDenied !(StreamId t)
- | InvalidServerResponse !Command !Command
- | ProtobufDecodingError !String
- | ServerError !(Maybe Text)
- | InvalidOperation !Text
- | StreamNotFound !StreamName
- | NotAuthenticatedOp
- | Aborted
- | ConnectionHasDropped
- data StreamId loc where
- StreamName :: Text -> StreamId EventNumber
- All :: StreamId Position
- type StreamName = StreamId EventNumber
- isAllStream :: StreamId t -> Bool
- 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
- type LogType = LogType' LogStr
- data LoggerFilter
- = LoggerFilter (LogSource -> LogLevel -> Bool)
- | LoggerLevel LogLevel
- data MonitoringBackend = MonitoringBackend {}
- noopMonitoringBackend :: MonitoringBackend
- 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.
Instances
Eq Credentials Source # | |
Defined in Database.EventStore.Internal.Settings (==) :: Credentials -> Credentials -> Bool # (/=) :: Credentials -> Credentials -> Bool # | |
Show Credentials Source # | |
Defined in Database.EventStore.Internal.Settings showsPrec :: Int -> Credentials -> ShowS # show :: Credentials -> String # showList :: [Credentials] -> ShowS # |
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
=noopMonitoringBackend
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.
data GossipSeed Source #
Represents a source of cluster gossip.
Instances
Show GossipSeed Source # | |
Defined in Database.EventStore.Internal.Discovery showsPrec :: Int -> GossipSeed -> ShowS # show :: GossipSeed -> String # showList :: [GossipSeed] -> ShowS # |
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.
Event number
data EventNumber Source #
Represents an event position within a stream.
Instances
Eq EventNumber Source # | |
Defined in Database.EventStore.Internal.Types (==) :: EventNumber -> EventNumber -> Bool # (/=) :: EventNumber -> EventNumber -> Bool # | |
Ord EventNumber Source # | |
Defined in Database.EventStore.Internal.Types compare :: EventNumber -> EventNumber -> Ordering # (<) :: EventNumber -> EventNumber -> Bool # (<=) :: EventNumber -> EventNumber -> Bool # (>) :: EventNumber -> EventNumber -> Bool # (>=) :: EventNumber -> EventNumber -> Bool # max :: EventNumber -> EventNumber -> EventNumber # min :: EventNumber -> EventNumber -> EventNumber # | |
Show EventNumber Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> EventNumber -> ShowS # show :: EventNumber -> String # showList :: [EventNumber] -> ShowS # | |
SubscriptionStream PersistentSubscription EventNumber Source # | |
streamStart :: EventNumber Source #
The first event in a stream.
streamEnd :: EventNumber Source #
The last event in the stream.
eventNumber :: Natural -> EventNumber Source #
the Nth event of a stream.
rawEventNumber :: Int64 -> EventNumber Source #
Returns a 'EventNumber from a raw Int64
.
eventNumberToInt64 :: EventNumber -> Int64 Source #
Returns a raw Int64
from an EventNumber
.
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. |
|
Instances
Show StreamMetadataResult Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> StreamMetadataResult -> ShowS # show :: StreamMetadataResult -> String # showList :: [StreamMetadataResult] -> ShowS # |
type family BatchResult t where ... Source #
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).
data ResolveLink Source #
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
Instances
Eq ResolveLink Source # | |
Defined in Database.EventStore.Internal.Types (==) :: ResolveLink -> ResolveLink -> Bool # (/=) :: ResolveLink -> ResolveLink -> Bool # | |
Show ResolveLink Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> ResolveLink -> ShowS # show :: ResolveLink -> String # showList :: [ResolveLink] -> ShowS # |
readEvent :: Connection -> StreamName -> EventNumber -> ResolveLink -> Maybe Credentials -> IO (Async (ReadResult EventNumber ReadEvent)) Source #
Reads a single event from given stream.
:: Connection | |
-> StreamId t | |
-> t | |
-> Int32 | Batch size |
-> ResolveLink | |
-> Maybe Credentials | |
-> IO (Async (BatchResult t)) |
Reads events from a stream backward.
:: Connection | |
-> StreamId t | |
-> t | |
-> Int32 | Batch size |
-> ResolveLink | |
-> Maybe Credentials | |
-> IO (Async (BatchResult t)) |
Reads events from a 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 | |
|
Instances
Eq StreamMetadata Source # | |
Defined in Database.EventStore.Internal.Types (==) :: StreamMetadata -> StreamMetadata -> Bool # (/=) :: StreamMetadata -> StreamMetadata -> Bool # | |
Show StreamMetadata Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> StreamMetadata -> ShowS # show :: StreamMetadata -> String # showList :: [StreamMetadata] -> ShowS # | |
ToJSON StreamMetadata Source # | |
Defined in Database.EventStore.Internal.Types toJSON :: StreamMetadata -> Value # toEncoding :: StreamMetadata -> Encoding # toJSONList :: [StreamMetadata] -> Value # toEncodingList :: [StreamMetadata] -> Encoding # | |
FromJSON StreamMetadata Source # | |
Defined in Database.EventStore.Internal.Types parseJSON :: Value -> Parser StreamMetadata # parseJSONList :: Value -> Parser [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
.
Instances
Eq TransactionId Source # | |
Defined in Database.EventStore.Internal (==) :: TransactionId -> TransactionId -> Bool # (/=) :: TransactionId -> TransactionId -> Bool # | |
Ord TransactionId Source # | |
Defined in Database.EventStore.Internal compare :: TransactionId -> TransactionId -> Ordering # (<) :: TransactionId -> TransactionId -> Bool # (<=) :: TransactionId -> TransactionId -> Bool # (>) :: TransactionId -> TransactionId -> Bool # (>=) :: TransactionId -> TransactionId -> Bool # max :: TransactionId -> TransactionId -> TransactionId # min :: TransactionId -> TransactionId -> TransactionId # | |
Show TransactionId Source # | |
Defined in Database.EventStore.Internal showsPrec :: Int -> TransactionId -> ShowS # show :: TransactionId -> String # showList :: [TransactionId] -> ShowS # |
:: 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 #
Instances
Show SubscriptionClosed Source # | |
Defined in Database.EventStore.Internal.Subscription.Types showsPrec :: Int -> SubscriptionClosed -> ShowS # show :: SubscriptionClosed -> String # showList :: [SubscriptionClosed] -> ShowS # | |
Exception SubscriptionClosed Source # | |
class SubscriptionStream s t | t -> s where Source #
Returns the stream of a subscription.
subscriptionStream :: s -> StreamId t Source #
Instances
class Subscription s Source #
Common operations supported by a subscription.
Instances
Subscription PersistentSubscription Source # | |
Subscription (RegularSubscription s) Source # | |
Defined in Database.EventStore.Internal.Subscription.Regular nextSubEvent :: RegularSubscription s -> IO SubAction Source # unsubscribe :: RegularSubscription s -> IO () Source # | |
Subscription (CatchupSubscription s) Source # | |
Defined in Database.EventStore.Internal.Subscription.Catchup nextSubEvent :: CatchupSubscription s -> IO SubAction Source # unsubscribe :: CatchupSubscription s -> IO () Source # |
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 |
Instances
Eq SubDropReason Source # | |
Defined in Database.EventStore.Internal.Subscription.Types (==) :: SubDropReason -> SubDropReason -> Bool # (/=) :: SubDropReason -> SubDropReason -> Bool # | |
Show SubDropReason Source # | |
Defined in Database.EventStore.Internal.Subscription.Types showsPrec :: Int -> SubDropReason -> ShowS # show :: SubDropReason -> String # showList :: [SubDropReason] -> ShowS # |
data SubDetails Source #
Subscription runtime details. Not useful for the user but at least it makes Haddock documentation generation less ugly.
unsubscribe :: Subscription s => s -> IO () Source #
Asynchronously unsubscribe from a subscription.
nextSubEvent :: Subscription s => s -> IO SubAction Source #
Asks for the next subcription event. If that function is called after a SubDropped event, expect it to hang indefinitely.
streamSubEvents :: Subscription s => s -> Stream (Of SubAction) IO () Source #
Streams a subscription events. The stream will end when hitting Dropped
event but will still emit it.
streamSubResolvedEvents :: Subscription s => s -> Stream (Of ResolvedEvent) IO () Source #
Like streamSubEvent
but will only emit ResolvedEvent
.
Volatile Subscription
data RegularSubscription t 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.
Instances
Subscription (RegularSubscription s) Source # | |
Defined in Database.EventStore.Internal.Subscription.Regular nextSubEvent :: RegularSubscription s -> IO SubAction Source # unsubscribe :: RegularSubscription s -> IO () Source # | |
SubscriptionStream (RegularSubscription t) t Source # | |
Defined in Database.EventStore.Internal.Subscription.Regular subscriptionStream :: RegularSubscription t -> StreamId t Source # |
subscribe :: Connection -> StreamId t -> ResolveLink -> Maybe Credentials -> IO (RegularSubscription t) Source #
Subscribes to a stream.
Catch-up Subscription
data CatchupSubscription t 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.
Instances
Subscription (CatchupSubscription s) Source # | |
Defined in Database.EventStore.Internal.Subscription.Catchup nextSubEvent :: CatchupSubscription s -> IO SubAction Source # unsubscribe :: CatchupSubscription s -> IO () Source # | |
SubscriptionStream (CatchupSubscription t) t Source # | |
Defined in Database.EventStore.Internal.Subscription.Catchup subscriptionStream :: CatchupSubscription t -> StreamId t Source # |
:: Connection | |
-> StreamId t | |
-> ResolveLink | |
-> Maybe t | |
-> Maybe Int32 | Batch size |
-> Maybe Credentials | |
-> IO (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
.
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 | |
|
Instances
Eq PersistentSubscriptionSettings Source # | |
Show PersistentSubscriptionSettings Source # | |
Defined in Database.EventStore.Internal.Types |
data SystemConsumerStrategy Source #
System supported consumer strategies for use with persistent subscriptions.
DispatchToSingle | Distributes events to a single client until the bufferSize is reached. After which the next client is selected in a round robin style, and the process is repeated. |
RoundRobin | Distributes events to all clients evenly. If the client buffer-size is reached the client is ignored until events are acknowledged/not acknowledged. |
Pinned | For use with an indexing projection such as the system $by_category projection. Event Store inspects event for its source stream id, hashing the id to one of 1024 buckets assigned to individual clients. When a client disconnects it's buckets are assigned to other clients. When a client connects, it is assigned some of the existing buckets. This naively attempts to maintain a balanced workload. The main aim of this strategy is to decrease the likelihood of concurrency and ordering issues while maintaining load balancing. This is not a guarantee, and you should handle the usual ordering and concurrency issues. |
Instances
Eq SystemConsumerStrategy Source # | |
Defined in Database.EventStore.Internal.Types | |
Show SystemConsumerStrategy Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> SystemConsumerStrategy -> ShowS # show :: SystemConsumerStrategy -> String # showList :: [SystemConsumerStrategy] -> ShowS # |
Gathers every possible Nak actions.
Instances
Enum NakAction Source # | |
Defined in Database.EventStore.Internal.Subscription.Message succ :: NakAction -> NakAction # pred :: NakAction -> NakAction # fromEnum :: NakAction -> Int # enumFrom :: NakAction -> [NakAction] # enumFromThen :: NakAction -> NakAction -> [NakAction] # enumFromTo :: NakAction -> NakAction -> [NakAction] # enumFromThenTo :: NakAction -> NakAction -> NakAction -> [NakAction] # | |
Eq NakAction Source # | |
Show NakAction Source # | |
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. |
Instances
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.
SliceEndOfStream | |
Slice ![ResolvedEvent] !(Maybe t) |
sliceEvents :: Slice t -> [ResolvedEvent] Source #
Gets slice's ResolvedEvents
s.
emptySlice :: Slice t Source #
Empty slice.
newtype DeleteResult Source #
Returned after deleting a stream. Position
of the write.
Instances
Eq DeleteResult Source # | |
Defined in Database.EventStore.Internal.Operation.DeleteStream (==) :: DeleteResult -> DeleteResult -> Bool # (/=) :: DeleteResult -> DeleteResult -> Bool # | |
Show DeleteResult Source # | |
Defined in Database.EventStore.Internal.Operation.DeleteStream showsPrec :: Int -> DeleteResult -> ShowS # show :: DeleteResult -> String # showList :: [DeleteResult] -> ShowS # |
data WriteResult Source #
Returned after writing to a stream.
WriteResult | |
|
Instances
Eq WriteResult Source # | |
Defined in Database.EventStore.Internal.Operation.Write.Common (==) :: WriteResult -> WriteResult -> Bool # (/=) :: WriteResult -> WriteResult -> Bool # | |
Show WriteResult Source # | |
Defined in Database.EventStore.Internal.Operation.Write.Common showsPrec :: Int -> WriteResult -> ShowS # show :: WriteResult -> String # showList :: [WriteResult] -> ShowS # |
data ReadResult t a where Source #
Enumeration detailing the possible outcomes of reading a stream.
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 |
Instances
data RecordedEvent Source #
Represents a previously written event.
RecordedEvent | |
|
Instances
Show RecordedEvent Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> RecordedEvent -> ShowS # show :: RecordedEvent -> String # showList :: [RecordedEvent] -> ShowS # |
Represents the result of looking up a specific event number from a stream.
type StreamSlice = Slice EventNumber 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).
Instances
Eq ReadDirection Source # | |
Defined in Database.EventStore.Internal.Types (==) :: ReadDirection -> ReadDirection -> Bool # (/=) :: ReadDirection -> ReadDirection -> Bool # | |
Show ReadDirection Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> ReadDirection -> ShowS # show :: ReadDirection -> String # showList :: [ReadDirection] -> ShowS # |
data ResolvedEvent Source #
A structure representing a single event or an resolved link event.
ResolvedEvent | |
|
Instances
Show ResolvedEvent Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> ResolvedEvent -> ShowS # show :: ResolvedEvent -> String # showList :: [ResolvedEvent] -> ShowS # |
data OperationError Source #
Operation exception that can occurs on an operation response.
WrongExpectedVersion !Text !ExpectedVersion | Stream and Expected Version |
StreamDeleted !StreamName | Stream |
InvalidTransaction | |
AccessDenied !(StreamId t) | Stream |
InvalidServerResponse !Command !Command | Expected, Found |
ProtobufDecodingError !String | |
ServerError !(Maybe Text) | Reason |
InvalidOperation !Text | |
StreamNotFound !StreamName | |
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. |
ConnectionHasDropped |
Instances
Show OperationError Source # | |
Defined in Database.EventStore.Internal.Operation showsPrec :: Int -> OperationError -> ShowS # show :: OperationError -> String # showList :: [OperationError] -> ShowS # | |
Exception OperationError Source # | |
Defined in Database.EventStore.Internal.Operation |
data StreamId loc where Source #
Represents a regular stream name or $all stream.
StreamName :: Text -> StreamId EventNumber | |
All :: StreamId Position |
type StreamName = StreamId EventNumber Source #
isAllStream :: StreamId t -> Bool Source #
If the stream is the $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
data LoggerFilter Source #
LoggerFilter (LogSource -> LogLevel -> Bool) | |
LoggerLevel LogLevel |
Monitoring
data MonitoringBackend Source #
Monitoring backend abstraction. Gathers all the metrics currently tracked
by the client. Used only by the TCP interface. Be careful as
MonitoringBackend
is used in a very tight loop. Each
function must not throw any exception or the client will end in a broken
state.
MonitoringBackend | |
|
noopMonitoringBackend :: MonitoringBackend Source #
A MonitoringBackend
that does nothing.
Misc
Internal command representation.
data DropReason Source #
Represents the reason subscription drop happened.
D_Unsubscribed | |
D_AccessDenied | |
D_NotFound | |
D_PersistentSubscriptionDeleted | |
D_SubscriberMaxCountReached |
Instances
Enum DropReason Source # | |
Defined in Database.EventStore.Internal.Subscription.Message succ :: DropReason -> DropReason # pred :: DropReason -> DropReason # toEnum :: Int -> DropReason # fromEnum :: DropReason -> Int # enumFrom :: DropReason -> [DropReason] # enumFromThen :: DropReason -> DropReason -> [DropReason] # enumFromTo :: DropReason -> DropReason -> [DropReason] # enumFromThenTo :: DropReason -> DropReason -> DropReason -> [DropReason] # | |
Eq DropReason Source # | |
Defined in Database.EventStore.Internal.Subscription.Message (==) :: DropReason -> DropReason -> Bool # (/=) :: DropReason -> DropReason -> Bool # | |
Show DropReason Source # | |
Defined in Database.EventStore.Internal.Subscription.Message showsPrec :: Int -> DropReason -> ShowS # show :: DropReason -> String # showList :: [DropReason] -> ShowS # |
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.
Instances
Eq ExpectedVersion Source # | |
Defined in Database.EventStore.Internal.Types (==) :: ExpectedVersion -> ExpectedVersion -> Bool # (/=) :: ExpectedVersion -> ExpectedVersion -> Bool # | |
Show ExpectedVersion Source # | |
Defined in Database.EventStore.Internal.Types showsPrec :: Int -> ExpectedVersion -> ShowS # show :: ExpectedVersion -> String # showList :: [ExpectedVersion] -> ShowS # |
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: base-4.9.0.0
a :| [a] infixr 5 |
Instances
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.
Instances
Show TLSSettings | |
Defined in Network.Connection.Types showsPrec :: Int -> TLSSettings -> ShowS # show :: TLSSettings -> String # showList :: [TLSSettings] -> ShowS # | |
Default TLSSettings | |
Defined in Network.Connection.Types def :: TLSSettings # |
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.