Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
To implement an ASAP:O consumer, you should only need this interface. It exposes no memory-management functions (like free) or pointers, and is thus safe to use.
Synopsis
- data FilesystemFlag
- newtype ServerName = ServerName Text
- data IncludeIncompleteFlag
- newtype SourcePath = SourcePath Text
- data Dataset = Dataset {}
- data MessageMeta = MessageMeta {}
- data DeleteFlag
- data ErrorOnNotExistFlag
- data Consumer
- data NetworkConnectionType
- data StreamFilter
- data MessageMetaHandle
- data GroupId
- data Error = Error {}
- data ErrorType
- withConsumer :: forall a. ServerName -> SourcePath -> FilesystemFlag -> SourceCredentials -> (Error -> IO a) -> (Consumer -> IO a) -> IO a
- retrieveDataForMessageMeta :: Consumer -> MessageMeta -> IO (Either Error ByteString)
- queryMessages :: Consumer -> Text -> StreamName -> IO (Either Error [MessageMeta])
- resendNacs :: Consumer -> Bool -> NominalDiffTime -> Word64 -> IO ()
- getNextDataset :: Consumer -> GroupId -> Word64 -> StreamName -> IO (Either Error Dataset)
- retrieveDataFromMeta :: Consumer -> MessageMetaHandle -> IO (Either Error ByteString)
- setStreamPersistent :: Consumer -> StreamName -> IO (Either Error Int)
- getLastMessageMetaAndData :: Consumer -> StreamName -> IO (Either Error (MessageMeta, ByteString))
- getLastMessageMeta :: Consumer -> StreamName -> IO (Either Error MessageMeta)
- getLastMessageData :: Consumer -> StreamName -> IO (Either Error ByteString)
- getLastInGroupMessageMetaAndData :: Consumer -> StreamName -> GroupId -> IO (Either Error (MessageMeta, ByteString))
- getLastInGroupMessageMeta :: Consumer -> StreamName -> GroupId -> IO (Either Error MessageMeta)
- getLastInGroupMessageData :: Consumer -> StreamName -> GroupId -> IO (Either Error ByteString)
- getNextMessageMetaAndData :: Consumer -> StreamName -> GroupId -> IO (Either Error (MessageMeta, ByteString))
- getNextMessageMeta :: Consumer -> StreamName -> GroupId -> IO (Either Error MessageMeta)
- getNextMessageData :: Consumer -> StreamName -> GroupId -> IO (Either Error ByteString)
- getCurrentDatasetCount :: Consumer -> StreamName -> IncludeIncompleteFlag -> IO (Either Error Int)
- getBeamtimeMeta :: Consumer -> IO (Either Error (Maybe Text))
- getCurrentSize :: Consumer -> StreamName -> IO (Either Error Int)
- acknowledge :: Consumer -> GroupId -> StreamName -> MessageId -> IO (Either Error Int)
- negativeAcknowledge :: Consumer -> GroupId -> StreamName -> MessageId -> NominalDiffTime -> IO (Either Error Int)
- getMessageMetaAndDataById :: Consumer -> StreamName -> MessageId -> IO (Either Error (MessageMeta, ByteString))
- getMessageMetaById :: Consumer -> StreamName -> MessageId -> IO (Either Error MessageMeta)
- getMessageDataById :: Consumer -> StreamName -> MessageId -> IO (Either Error ByteString)
- getUnacknowledgedMessages :: Consumer -> GroupId -> StreamName -> (MessageId, MessageId) -> IO (Either Error [MessageId])
- withGroupId :: forall a. Consumer -> (Error -> IO a) -> (GroupId -> IO a) -> IO a
- queryMessagesHandles :: Consumer -> Text -> StreamName -> IO (Either Error [MessageMetaHandle])
- setTimeout :: Consumer -> NominalDiffTime -> IO ()
- getLastDataset :: Consumer -> Word64 -> StreamName -> IO (Either Error Dataset)
- getLastDatasetInGroup :: Consumer -> GroupId -> Word64 -> StreamName -> IO (Either Error Dataset)
- resetLastReadMarker :: Consumer -> GroupId -> StreamName -> IO (Either Error Int)
- setLastReadMarker :: Consumer -> GroupId -> StreamName -> MessageId -> IO (Either Error Int)
- getCurrentConnectionType :: Consumer -> IO NetworkConnectionType
- getStreamList :: Consumer -> Maybe StreamName -> StreamFilter -> IO (Either Error [StreamInfo])
- deleteStream :: Consumer -> StreamName -> DeleteFlag -> ErrorOnNotExistFlag -> IO (Either Error Int)
- resolveMetadata :: MessageMetaHandle -> IO MessageMeta
Documentation
data FilesystemFlag Source #
Whether to use the filesystem or do it in-memory
Instances
Eq FilesystemFlag Source # | |
Defined in Asapo.Either.Consumer (==) :: FilesystemFlag -> FilesystemFlag -> Bool # (/=) :: FilesystemFlag -> FilesystemFlag -> Bool # |
data IncludeIncompleteFlag Source #
Anti-boolean-blindness for "include incomplete data sets in list"
Instances
Eq IncludeIncompleteFlag Source # | |
Defined in Asapo.Either.Consumer (==) :: IncludeIncompleteFlag -> IncludeIncompleteFlag -> Bool # (/=) :: IncludeIncompleteFlag -> IncludeIncompleteFlag -> Bool # |
newtype SourcePath Source #
Wrapper for a source path (dubious to not use FilePath
, but let's see)
Metadata for a dataset
data MessageMeta Source #
Metadata for a single message
Instances
Show MessageMeta Source # | |
Defined in Asapo.Either.Consumer showsPrec :: Int -> MessageMeta -> ShowS # show :: MessageMeta -> String # showList :: [MessageMeta] -> ShowS # |
data DeleteFlag Source #
Anti-boolean-blindness for delete or not delete metadata when deleting a stream
Instances
Eq DeleteFlag Source # | |
Defined in Asapo.Either.Consumer (==) :: DeleteFlag -> DeleteFlag -> Bool # (/=) :: DeleteFlag -> DeleteFlag -> Bool # |
data ErrorOnNotExistFlag Source #
Anti-boolean-blindness for "error on not existing data"
Instances
Eq ErrorOnNotExistFlag Source # | |
Defined in Asapo.Either.Consumer (==) :: ErrorOnNotExistFlag -> ErrorOnNotExistFlag -> Bool # (/=) :: ErrorOnNotExistFlag -> ErrorOnNotExistFlag -> Bool # |
data NetworkConnectionType Source #
Network connection type
ConnectionUndefined | not sure about this |
ConnectionTcp | TCP |
ConnectionFabric | not sure about this |
data MessageMetaHandle Source #
Metadata handle, can be passed around as a pure value and be used to retrieve actual data for the metadata as a two-step process, using the retrieveDataForMessageMeta
function(s)
Instances
Show MessageMetaHandle Source # | |
Defined in Asapo.Either.Consumer showsPrec :: Int -> MessageMetaHandle -> ShowS # show :: MessageMetaHandle -> String # showList :: [MessageMetaHandle] -> ShowS # |
Wrapper around an ASAP:O producer error, with an additional error code
Error | |
|
withConsumer :: forall a. ServerName -> SourcePath -> FilesystemFlag -> SourceCredentials -> (Error -> IO a) -> (Consumer -> IO a) -> IO a Source #
Create a consumer and do something with it. This is the main entrypoint into the consumer
retrieveDataForMessageMeta :: Consumer -> MessageMeta -> IO (Either Error ByteString) Source #
Retrieve actual data for the handle
:: Consumer | |
-> Text | Actual query string, see the docs for syntax |
-> StreamName | |
-> IO (Either Error [MessageMeta]) |
Query messages, return handles without data
:: Consumer | |
-> Bool | resend yes/no |
-> NominalDiffTime | delay |
-> Word64 | attempts |
-> IO () |
Reset negative acknowledgements
:: Consumer | |
-> GroupId | |
-> Word64 | Wait until dataset has these number of messages (0 for maximum size) |
-> StreamName | |
-> IO (Either Error Dataset) |
Get the next dataset for a stream
retrieveDataFromMeta :: Consumer -> MessageMetaHandle -> IO (Either Error ByteString) Source #
Retrieve data for the given metadata handle
setStreamPersistent :: Consumer -> StreamName -> IO (Either Error Int) Source #
Set a stream persistent
getLastMessageMetaAndData :: Consumer -> StreamName -> IO (Either Error (MessageMeta, ByteString)) Source #
Retrieve the last message in the stream, with data and metadata
getLastMessageMeta :: Consumer -> StreamName -> IO (Either Error MessageMeta) Source #
Retrieve the last message in the stream, only metadata (you can get the data later with retrieveDataFromMessageMeta
)
getLastMessageData :: Consumer -> StreamName -> IO (Either Error ByteString) Source #
Retrieve the last message in the stream, only data
getLastInGroupMessageMetaAndData :: Consumer -> StreamName -> GroupId -> IO (Either Error (MessageMeta, ByteString)) Source #
Retrieve the last message in a given stream and group, with data and metadata
getLastInGroupMessageMeta :: Consumer -> StreamName -> GroupId -> IO (Either Error MessageMeta) Source #
Retrieve the last message in a given stream and group, only metadata (you can get the data later with retrieveDataFromMessageMeta
)
getLastInGroupMessageData :: Consumer -> StreamName -> GroupId -> IO (Either Error ByteString) Source #
Retrieve the last message in a given stream and group, only data
getNextMessageMetaAndData :: Consumer -> StreamName -> GroupId -> IO (Either Error (MessageMeta, ByteString)) Source #
Retrieve the next message in the stream and group, with data and metadata
getNextMessageMeta :: Consumer -> StreamName -> GroupId -> IO (Either Error MessageMeta) Source #
Retrieve the next message in the stream and group, only metadata (you can get the data later with retrieveDataFromMessageMeta
)
getNextMessageData :: Consumer -> StreamName -> GroupId -> IO (Either Error ByteString) Source #
Retrieve the next message in the stream and group, only data
getCurrentDatasetCount :: Consumer -> StreamName -> IncludeIncompleteFlag -> IO (Either Error Int) Source #
Get number of datasets in stream
getBeamtimeMeta :: Consumer -> IO (Either Error (Maybe Text)) Source #
Get beamtime metadata (which can be not set, in which case Nothing
is returned)
getCurrentSize :: Consumer -> StreamName -> IO (Either Error Int) Source #
Get the current size (number of messages) of the stream
acknowledge :: Consumer -> GroupId -> StreamName -> MessageId -> IO (Either Error Int) Source #
Acknowledge a specific message
:: Consumer | |
-> GroupId | |
-> StreamName | |
-> MessageId | |
-> NominalDiffTime | delay |
-> IO (Either Error Int) |
Negatively acknowledge a specific message
getMessageMetaAndDataById :: Consumer -> StreamName -> MessageId -> IO (Either Error (MessageMeta, ByteString)) Source #
Given a message ID, retrieve both metadata and data
getMessageMetaById :: Consumer -> StreamName -> MessageId -> IO (Either Error MessageMeta) Source #
Given a message ID, retrieve only the metadata (you can get the data later with retrieveDataFromMessageMeta
)
getMessageDataById :: Consumer -> StreamName -> MessageId -> IO (Either Error ByteString) Source #
Given a message ID, retrieve only the data
getUnacknowledgedMessages :: Consumer -> GroupId -> StreamName -> (MessageId, MessageId) -> IO (Either Error [MessageId]) Source #
Get a list of all unacknowledged message IDs in a range
withGroupId :: forall a. Consumer -> (Error -> IO a) -> (GroupId -> IO a) -> IO a Source #
Allocate a group ID and call a callback
:: Consumer | |
-> Text | Actual query string, see the docs for syntax |
-> StreamName | |
-> IO (Either Error [MessageMetaHandle]) |
Query messages, return handles without data
setTimeout :: Consumer -> NominalDiffTime -> IO () Source #
Set the global consumer timeout
:: Consumer | |
-> Word64 | Wait until dataset has these number of messages (0 for maximum size) |
-> StreamName | |
-> IO (Either Error Dataset) |
Get the last dataset in the stream
getLastDatasetInGroup Source #
:: Consumer | |
-> GroupId | |
-> Word64 | Wait until dataset has these number of messages (0 for maximum size) |
-> StreamName | |
-> IO (Either Error Dataset) |
Get the last data ste in the given group
resetLastReadMarker :: Consumer -> GroupId -> StreamName -> IO (Either Error Int) Source #
Reset the last read marker for a specific group
setLastReadMarker :: Consumer -> GroupId -> StreamName -> MessageId -> IO (Either Error Int) Source #
Set the last read marker for the stream
getCurrentConnectionType :: Consumer -> IO NetworkConnectionType Source #
Retrieve the current consumer connection type
:: Consumer | |
-> Maybe StreamName | Pass |
-> StreamFilter | |
-> IO (Either Error [StreamInfo]) |
Retrieve the list of streams with metadata
deleteStream :: Consumer -> StreamName -> DeleteFlag -> ErrorOnNotExistFlag -> IO (Either Error Int) Source #
Delete a given stream
resolveMetadata :: MessageMetaHandle -> IO MessageMeta Source #
Get the actual metadata hiding behind a handle (shouldn't be necessary when using the convenience interfaces)