hs-asapo-0.9.0: Haskell bindings for ASAP:O
Safe HaskellSafe-Inferred
LanguageHaskell98

Asapo.Either.Consumer

Description

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

Documentation

data FilesystemFlag Source #

Whether to use the filesystem or do it in-memory

Instances

Instances details
Eq FilesystemFlag Source # 
Instance details

Defined in Asapo.Either.Consumer

newtype ServerName Source #

Wrapper for a server name (something like "host:port")

Constructors

ServerName Text 

data IncludeIncompleteFlag Source #

Anti-boolean-blindness for "include incomplete data sets in list"

newtype SourcePath Source #

Wrapper for a source path (dubious to not use FilePath, but let's see)

Constructors

SourcePath Text 

data Dataset Source #

Metadata for a dataset

data DeleteFlag Source #

Anti-boolean-blindness for delete or not delete metadata when deleting a stream

Constructors

DeleteMeta 
DontDeleteMeta 

Instances

Instances details
Eq DeleteFlag Source # 
Instance details

Defined in Asapo.Either.Consumer

data ErrorOnNotExistFlag Source #

Anti-boolean-blindness for "error on not existing data"

data Consumer Source #

Wrapper around a consumer handle. Create with the withConsumer function(s).

data NetworkConnectionType Source #

Network connection type

Constructors

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

Instances details
Show MessageMetaHandle Source # 
Instance details

Defined in Asapo.Either.Consumer

data GroupId Source #

Wrapper around a group ID

data Error Source #

Wrapper around an ASAP:O producer error, with an additional error code

Constructors

Error 

Instances

Instances details
Show Error Source # 
Instance details

Defined in Asapo.Either.Consumer

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

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

queryMessages Source #

Arguments

:: Consumer 
-> Text

Actual query string, see the docs for syntax

-> StreamName 
-> IO (Either Error [MessageMeta]) 

Query messages, return handles without data

resendNacs Source #

Arguments

:: Consumer 
-> Bool

resend yes/no

-> NominalDiffTime

delay

-> Word64

attempts

-> IO () 

Reset negative acknowledgements

getNextDataset Source #

Arguments

:: 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

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

negativeAcknowledge Source #

Arguments

:: 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

queryMessagesHandles Source #

Arguments

:: 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

getLastDataset Source #

Arguments

:: 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 #

Arguments

:: 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

getStreamList Source #

Arguments

:: Consumer 
-> Maybe StreamName

Pass Nothing to get all streams

-> StreamFilter 
-> IO (Either Error [StreamInfo]) 

Retrieve the list of streams with metadata

resolveMetadata :: MessageMetaHandle -> IO MessageMeta Source #

Get the actual metadata hiding behind a handle (shouldn't be necessary when using the convenience interfaces)