network-mux
Safe HaskellNone
LanguageHaskell2010

Network.Mux.Compat

Synopsis

Documentation

muxStart :: forall m (mode :: MuxMode) a b. (MonadAsync m, MonadFork m, MonadLabelledSTM m, Alternative (STM m), MonadThrow (STM m), MonadTimer m, MonadMask m) => Tracer m MuxTrace -> MuxApplication mode m a b -> MuxBearer m -> m () Source #

Mux bearers

data MuxBearer (m :: Type -> Type) Source #

Low level access to underlying socket or pipe. There are three smart constructors:

newtype MakeBearer (m :: Type -> Type) fd Source #

Constructors

MakeBearer 

Fields

Defining MuxApplications

newtype MuxApplication (mode :: MuxMode) (m :: Type -> Type) a b Source #

Constructors

MuxApplication [MuxMiniProtocol mode m a b] 

data RunMiniProtocol (mode :: MuxMode) (m :: Type -> Type) a b where Source #

Constructors

InitiatorProtocolOnly :: forall (m :: Type -> Type) a. (Channel m -> m (a, Maybe ByteString)) -> RunMiniProtocol 'InitiatorMode m a Void 
ResponderProtocolOnly :: forall (m :: Type -> Type) b. (Channel m -> m (b, Maybe ByteString)) -> RunMiniProtocol 'ResponderMode m Void b 
InitiatorAndResponderProtocol :: forall (m :: Type -> Type) a b. (Channel m -> m (a, Maybe ByteString)) -> (Channel m -> m (b, Maybe ByteString)) -> RunMiniProtocol 'InitiatorResponderMode m a b 

newtype MiniProtocolNum Source #

The wire format includes the protocol numbers, and it's vital that these are stable. They are not necessarily dense however, as new ones are added and some old ones retired. So we use a dedicated class for this rather than reusing Enum. This also covers unrecognised protocol numbers on the decoding side.

Constructors

MiniProtocolNum Word16 

Instances

Instances details
Enum MiniProtocolNum Source # 
Instance details

Defined in Network.Mux.Types

Ix MiniProtocolNum Source # 
Instance details

Defined in Network.Mux.Types

Show MiniProtocolNum Source # 
Instance details

Defined in Network.Mux.Types

Eq MiniProtocolNum Source # 
Instance details

Defined in Network.Mux.Types

Ord MiniProtocolNum Source # 
Instance details

Defined in Network.Mux.Types

newtype MiniProtocolLimits Source #

Per Miniprotocol limits

Constructors

MiniProtocolLimits 

Fields

  • maximumIngressQueue :: Int

    Limit on the maximum number of bytes that can be queued in the miniprotocol's ingress queue.

data MiniProtocolDir Source #

Constructors

InitiatorDir 
ResponderDir 

Instances

Instances details
Bounded MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Enum MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Ix MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Show MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Eq MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Ord MiniProtocolDir Source # 
Instance details

Defined in Network.Mux.Types

Errors

data MuxError Source #

Error type used in across the mux layer.

Constructors

MuxError 

Instances

Instances details
Exception MuxError Source # 
Instance details

Defined in Network.Mux.Trace

Generic MuxError Source # 
Instance details

Defined in Network.Mux.Trace

Associated Types

type Rep MuxError 
Instance details

Defined in Network.Mux.Trace

type Rep MuxError = D1 ('MetaData "MuxError" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "MuxError" 'PrefixI 'True) (S1 ('MetaSel ('Just "errorType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MuxErrorType) :*: S1 ('MetaSel ('Just "errorMsg") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String)))

Methods

from :: MuxError -> Rep MuxError x #

to :: Rep MuxError x -> MuxError #

Show MuxError Source # 
Instance details

Defined in Network.Mux.Trace

type Rep MuxError Source # 
Instance details

Defined in Network.Mux.Trace

type Rep MuxError = D1 ('MetaData "MuxError" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "MuxError" 'PrefixI 'True) (S1 ('MetaSel ('Just "errorType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MuxErrorType) :*: S1 ('MetaSel ('Just "errorMsg") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String)))

data MuxErrorType Source #

Enumeration of error conditions.

Constructors

MuxUnknownMiniProtocol

returned by decodeMuxSDUHeader, thrown by MuxBearer.

MuxDecodeError

return by decodeMuxSDUHeader, thrown by MuxBearer.

MuxBearerClosed

thrown by MuxBearer when received a null byte.

MuxIngressQueueOverRun

thrown by demux when violating maximumIngressQueue byte limit.

MuxInitiatorOnly

thrown when data arrives on a responder channel when the mux was set up as an InitiatorApp.

MuxIOException IOException

IOException thrown by

MuxSDUReadTimeout

thrown when reading of a single SDU takes too long

MuxSDUWriteTimeout

thrown when writing a single SDU takes too long

MuxShutdown !(Maybe MuxErrorType)

Result of runMiniProtocol's completionAction in case of an error or mux being closed while a mini-protocol was still running, this is not a clean exit.

MuxCleanShutdown

Mux stopped by stopMux

Instances

Instances details
Show MuxErrorType Source # 
Instance details

Defined in Network.Mux.Trace

Eq MuxErrorType Source # 
Instance details

Defined in Network.Mux.Trace

Tracing

data MuxBearerState Source #

Constructors

Mature

MuxBearer has successfully completed the handshake.

Dead

MuxBearer is dead and the underlying bearer has been closed.

Instances

Instances details
Show MuxBearerState Source # 
Instance details

Defined in Network.Mux.Trace

Eq MuxBearerState Source # 
Instance details

Defined in Network.Mux.Trace

data WithMuxBearer peerid a Source #

Type used for tracing mux events.

Constructors

WithMuxBearer 

Fields

  • wmbPeerId :: !peerid

    A tag that should identify a specific mux bearer.

  • wmbEvent :: !a
     

Instances

Instances details
Generic (WithMuxBearer peerid a) Source # 
Instance details

Defined in Network.Mux.Trace

Associated Types

type Rep (WithMuxBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

type Rep (WithMuxBearer peerid a) = D1 ('MetaData "WithMuxBearer" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "WithMuxBearer" 'PrefixI 'True) (S1 ('MetaSel ('Just "wmbPeerId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peerid) :*: S1 ('MetaSel ('Just "wmbEvent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

Methods

from :: WithMuxBearer peerid a -> Rep (WithMuxBearer peerid a) x #

to :: Rep (WithMuxBearer peerid a) x -> WithMuxBearer peerid a #

(Show peerid, Show a) => Show (WithMuxBearer peerid a) Source # 
Instance details

Defined in Network.Mux.Trace

Methods

showsPrec :: Int -> WithMuxBearer peerid a -> ShowS #

show :: WithMuxBearer peerid a -> String #

showList :: [WithMuxBearer peerid a] -> ShowS #

type Rep (WithMuxBearer peerid a) Source # 
Instance details

Defined in Network.Mux.Trace

type Rep (WithMuxBearer peerid a) = D1 ('MetaData "WithMuxBearer" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "WithMuxBearer" 'PrefixI 'True) (S1 ('MetaSel ('Just "wmbPeerId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peerid) :*: S1 ('MetaSel ('Just "wmbEvent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))