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

Asapo.Either.Producer

Description

To implement an ASAP:O producer, you should only need this interface. It exposes no memory-management functions (like free) or pointers, and is thus safe to use.

Synopsis

Documentation

newtype Endpoint Source #

Wrapper around an ASAP:O producer endpoint (usually something like "host:port")

Constructors

Endpoint Text 

newtype ProcessingThreads Source #

Wrapper around the number of ASAP:O processing threads (simply to make call signatures mor readable)

Constructors

ProcessingThreads Int 

data RequestHandlerType Source #

This has no documentation in ASAP:O yet

newtype Error Source #

Wrapper around an ASAP:O producer error. Note that there is only an error "explanation" here, no error code, since the C interface does not expose this.

Constructors

Error Text 

Instances

Instances details
Show Error Source # 
Instance details

Defined in Asapo.Either.Producer

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

newtype Metadata Source #

Wrapper around metadata to be produced

Constructors

Metadata Text 

data DeletionFlags Source #

Constructors

DeleteMeta

Delete metadata also

DeleteErrorOnNotExist

Don't throw an error if the data doesn't exist anyways

Instances

Instances details
Eq DeletionFlags Source # 
Instance details

Defined in Asapo.Either.Producer

data Producer Source #

Opaque wrapper around an ASAP:O producer

data LogLevel Source #

Instances

Instances details
Eq LogLevel Source # 
Instance details

Defined in Asapo.Either.Producer

newtype FileName Source #

Wrapper around file name (dubious to use Text here, but fine for now)

Constructors

FileName Text 

newtype DatasetSubstream Source #

Wrapper around the substream to use

Constructors

DatasetSubstream Int 

newtype DatasetSize Source #

Wrapper around the dataset size to use

Constructors

DatasetSize Int 

data VersionInfo Source #

Instances

Instances details
Show VersionInfo Source # 
Instance details

Defined in Asapo.Either.Producer

data UpsertMode Source #

Constructors

UseUpsert 
NoUpsert 

data AutoIdFlag Source #

Anti-boolean-blindness for the "auto id" flag in the message header

Constructors

UseAutoId 
NoAutoId 

Instances

Instances details
Eq AutoIdFlag Source # 
Instance details

Defined in Asapo.Either.Producer

data TransferFlag Source #

Which data to transfer

data StorageFlag Source #

Where to store the data

data RequestResponse Source #

Information about the request and its response, to be used in the ASAP:O send callback

getRequestsQueueSize :: Producer -> IO Int Source #

Get current size of the requests queue (number of requests pending/being processed)

getRequestsQueueVolumeMb :: Producer -> IO Int Source #

Get current volume of the requests queue (total memory of occupied by pending/being processed requests)

setRequestsQueueLimits Source #

Arguments

:: Producer 
-> Int

Size (0 for unlimited)

-> Int

Volume (in MiB; 0 for unlimited)

-> IO () 

Set maximum size of the requests queue

checkError :: (Ptr AsapoErrorHandle -> IO b) -> IO (Either Error b) Source #

Helper function since most ASAP:O functions receive a pointer to an error handle as the last argument, so error checking becomes "abstractable"

checkErrorWithGivenHandle :: AsapoErrorHandle -> b -> IO (Either Error b) Source #

Internal function to check and return either an error (if it's present behind the given handle) or a "result" of some function that produced the error handle

withProducer Source #

Arguments

:: forall a. Endpoint 
-> ProcessingThreads 
-> RequestHandlerType 
-> SourceCredentials 
-> NominalDiffTime

timeout

-> (Error -> IO a) 
-> (Producer -> IO a) 
-> IO a 

Create a producer and do something with it. This is the main entrypoint into the producer

enableLocalLog :: Producer -> Bool -> IO () Source #

Enable/Disable logging to stdout

waitRequestsFinished :: Producer -> NominalDiffTime -> IO (Either Error Int) Source #

Wait for all outstanding requests to finish

getVersionInfo :: Producer -> IO (Either Error VersionInfo) Source #

Retrieve producer version info

getStreamInfo Source #

Arguments

:: Producer 
-> StreamName 
-> NominalDiffTime

Timeout

-> IO (Either Error StreamInfo) 

Retrieve info for a single stream

getStreamMeta Source #

Arguments

:: Producer 
-> StreamName 
-> NominalDiffTime

timeout

-> IO (Either Error (Maybe Text)) 

Retrieve metadata for the given stream (which might be missing, in which case Nothing is returned)

getBeamtimeMeta Source #

Arguments

:: Producer 
-> NominalDiffTime

timeout

-> IO (Either Error (Maybe Text)) 

Retrieve metadata for the given stream (which might be missing, in which case Nothing is returned)

deleteStream Source #

Arguments

:: Producer 
-> StreamName 
-> NominalDiffTime

timeout

-> [DeletionFlags] 
-> IO (Either Error Int) 

Delete the given stream

getLastStream Source #

Arguments

:: Producer 
-> NominalDiffTime

Timeout

-> IO (Either Error StreamInfo) 

Retrieve info for the latest stream

send :: Producer -> MessageId -> FileName -> Metadata -> DatasetSubstream -> DatasetSize -> AutoIdFlag -> ByteString -> TransferFlag -> StorageFlag -> StreamName -> (RequestResponse -> IO ()) -> IO (Either Error Int) Source #

Send a message containing raw data. Due to newtype and enum usage, all parameter should be self-explanatory

sendFile Source #

Arguments

:: Producer 
-> MessageId 
-> FileName

File name to put into the message header

-> Metadata 
-> DatasetSubstream 
-> DatasetSize 
-> AutoIdFlag 
-> Int

Size

-> FileName

File to actually send

-> TransferFlag 
-> StorageFlag 
-> StreamName 
-> (RequestResponse -> IO ()) 
-> IO (Either Error Int) 

Send a message containing a file. Due to newtype and enum usage, all parameter should be self-explanatory

sendStreamFinishedFlag :: Producer -> StreamName -> MessageId -> StreamName -> (RequestResponse -> IO ()) -> IO (Either Error Int) Source #

As the title says, send the "stream finished" flag

sendBeamtimeMetadata :: Producer -> Metadata -> MetadataIngestMode -> UpsertMode -> (RequestResponse -> IO ()) -> IO (Either Error Int) Source #

Send or extend beamtime metadata

setLogLevel :: Producer -> LogLevel -> IO () Source #

Set the log level

enableRemoteLog :: Producer -> Bool -> IO () Source #

Enable/Disable logging to the central server

setCredentials :: Producer -> SourceCredentials -> IO (Either Error Int) Source #

Set a different set of credentials