Portability | non-portable |
---|---|
Stability | experimental |
Safe Haskell | None |
Fundamental streaming types
- type RIO = ResourceT IO
- type Source = Source RIO ByteString
- type Sink = Sink ByteString RIO ()
- type SinkR r = Sink ByteString RIO r
- type Conduit o r = ConduitM ByteString o RIO r
- type Conduit_ = Conduit ByteString ()
- streamList :: [ByteString] -> Producer RIO ByteString
- passThrough :: Conduit ByteString ()
- data LinkType
- type OnError_ = Criticality -> SomeException -> String -> IO ()
- data Criticality
- data StreamException
- type Identifier = String
- type Service = String
- type Identity = ByteString
- type Body = [ByteString]
- type Msec = Int
- type Timeout = Timeout
- type Context = Context
- type Size = Size
- withContext :: Size -> (Context -> IO a) -> IO a
Conduits
type Source = Source RIO ByteStringSource
A stream source
type Sink = Sink ByteString RIO ()Source
A stream sink without return type
type SinkR r = Sink ByteString RIO rSource
A stream sink wit return type
type Conduit o r = ConduitM ByteString o RIO rSource
A conduit that links source and sink
applying some transformation to the stream.
Input is always ByteString
,
output and return type may vary.
type Conduit_ = Conduit ByteString ()Source
Simplified Conduit where output
is always ByteString
and no final value is returned.
streamList :: [ByteString] -> Producer RIO ByteStringSource
Streaming the elements of a list
passThrough :: Conduit ByteString ()Source
Pass the stream through without applying any transformation to it
Link Type
A zeromq AccessPoint
can be bound or connected to its address.
Only one peer can bind the address,
all other parties have to connect.
Error Handling
type OnError_ = Criticality -> SomeException -> String -> IO ()Source
Error handler for all services
that are implemented as background services,
e.g. servers and brokers.
The handler receives the Criticality
of the error event,
the exception and an additional descriptive string.
A good policy is
to terminate or restart the service
when a Fatal
or Critical
error occurs
and to continue, if possible,
on a plain Error
.
The error handler may perform additional, user-defined actions,
such as logging the incident or
sending an SMS.
data Criticality Source
Indicates criticality of the error event
Error | The current operation (e.g. processing a request) has not terminated properly, but the service is able to continue; the error may have been caused by a faulty request or other temporal conditions. |
Critical | The event has impact on the process, leaving it in an unkown state. |
Fatal | The service cannot recover and will terminate |
data StreamException Source
Stream Exception
Some convenient definitions
type Identifier = StringSource
String identifying a stream in the streams device
type Identity = ByteStringSource
Identity of a communication peer, needed for complex patterns (e.g. broker)
type Body = [ByteString]Source
Message body, needed for complex patterns (e.g. broker)