Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Channel (m :: Type -> Type) a = Channel {}
- module Network.Mux.Channel
- fixedInputChannel :: MonadSTM m => [a] -> m (Channel m a)
- createConnectedBufferedChannelsUnbounded :: MonadSTM m => m (Channel m a, Channel m a)
- createConnectedBufferedChannels :: MonadLabelledSTM m => Natural -> m (Channel m a, Channel m a)
- createConnectedBufferedChannelsSTM :: forall (m :: Type -> Type) a. MonadLabelledSTM m => Natural -> STM m (Channel (STM m) a, Channel (STM m) a)
- createPipelineTestChannels :: MonadSTM m => Natural -> m (Channel m a, Channel m a)
Documentation
data Channel (m :: Type -> Type) a #
A channel which can send and receive values.
It is more general than what `network-mux` requires, see ByteChannel
instead. However this is useful for testing purposes when one is either
using mux
or connecting two ends directly.
Channel | |
|
module Network.Mux.Channel
fixedInputChannel :: MonadSTM m => [a] -> m (Channel m a) Source #
A Channel
with a fixed input, and where all output is discarded.
The input is guaranteed to be supplied via read
with the given chunk
boundaries.
This is only useful for testing. In particular the fixed chunk boundaries can be used to test that framing and other codecs work with any possible chunking.
createConnectedBufferedChannelsUnbounded :: MonadSTM m => m (Channel m a, Channel m a) Source #
Create a pair of channels that are connected via two unbounded buffers.
This is primarily useful for testing protocols.
createConnectedBufferedChannels :: MonadLabelledSTM m => Natural -> m (Channel m a, Channel m a) Source #
Create a pair of channels that are connected via N-place buffers.
This variant blocks when send
would exceed the maximum buffer size.
Use this variant when you want the environment rather than the Peer
to
limit the pipelining.
This is primarily useful for testing protocols.
createConnectedBufferedChannelsSTM :: forall (m :: Type -> Type) a. MonadLabelledSTM m => Natural -> STM m (Channel (STM m) a, Channel (STM m) a) Source #
As createConnectedBufferedChannels
, but in STM
.
TODO: it should return a pair of `Channel m a`.
createPipelineTestChannels :: MonadSTM m => Natural -> m (Channel m a, Channel m a) Source #
Create a pair of channels that are connected via N-place buffers.
This variant fails when send
would exceed the maximum buffer size.
Use this variant when you want the PeerPipelined
to limit the pipelining
itself, and you want to check that it does not exceed the expected level of
pipelining.
This is primarily useful for testing protocols.