Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- 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 ()
- data MuxBearer (m :: Type -> Type)
- newtype MakeBearer (m :: Type -> Type) fd = MakeBearer {}
- data MuxMode where
- type family HasInitiator (mode :: MuxMode) :: Bool where ...
- type family HasResponder (mode :: MuxMode) :: Bool where ...
- newtype MuxApplication (mode :: MuxMode) (m :: Type -> Type) a b = MuxApplication [MuxMiniProtocol mode m a b]
- data MuxMiniProtocol (mode :: MuxMode) (m :: Type -> Type) a b = MuxMiniProtocol {
- miniProtocolNum :: !MiniProtocolNum
- miniProtocolLimits :: !MiniProtocolLimits
- miniProtocolRun :: !(RunMiniProtocol mode m a b)
- data RunMiniProtocol (mode :: MuxMode) (m :: Type -> Type) a b where
- 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 = MiniProtocolNum Word16
- newtype MiniProtocolLimits = MiniProtocolLimits {}
- data MiniProtocolDir
- data MuxError = MuxError {
- errorType :: !MuxErrorType
- errorMsg :: !String
- data MuxErrorType
- traceMuxBearerState :: Tracer m MuxTrace -> MuxBearerState -> m ()
- data MuxBearerState
- data MuxTrace
- = MuxTraceRecvHeaderStart
- | MuxTraceRecvHeaderEnd MuxSDUHeader
- | MuxTraceRecvDeltaQObservation MuxSDUHeader Time
- | MuxTraceRecvDeltaQSample Double Int Int Double Double Double Double String
- | MuxTraceRecvStart Int
- | MuxTraceRecvEnd Int
- | MuxTraceSendStart MuxSDUHeader
- | MuxTraceSendEnd
- | MuxTraceState MuxBearerState
- | MuxTraceCleanExit MiniProtocolNum MiniProtocolDir
- | MuxTraceExceptionExit MiniProtocolNum MiniProtocolDir SomeException
- | MuxTraceChannelRecvStart MiniProtocolNum
- | MuxTraceChannelRecvEnd MiniProtocolNum Int
- | MuxTraceChannelSendStart MiniProtocolNum Int
- | MuxTraceChannelSendEnd MiniProtocolNum
- | MuxTraceHandshakeStart
- | MuxTraceHandshakeClientEnd DiffTime
- | MuxTraceHandshakeServerEnd
- | Exception e => MuxTraceHandshakeClientError e DiffTime
- | Exception e => MuxTraceHandshakeServerError e
- | MuxTraceSDUReadTimeoutException
- | MuxTraceSDUWriteTimeoutException
- | MuxTraceStartEagerly MiniProtocolNum MiniProtocolDir
- | MuxTraceStartOnDemand MiniProtocolNum MiniProtocolDir
- | MuxTraceStartedOnDemand MiniProtocolNum MiniProtocolDir
- | MuxTraceTerminating MiniProtocolNum MiniProtocolDir
- | MuxTraceStopping
- | MuxTraceStopped
- | MuxTraceTCPInfo StructTCPInfo Word16
- data WithMuxBearer peerid a = WithMuxBearer {}
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:
socketAsMuxBearer
pipeAsMuxBearer
Test.Mux.queuesAsMuxBearer
newtype MakeBearer (m :: Type -> Type) fd Source #
Defining MuxApplication
s
type family HasInitiator (mode :: MuxMode) :: Bool where ... Source #
type family HasResponder (mode :: MuxMode) :: Bool where ... Source #
newtype MuxApplication (mode :: MuxMode) (m :: Type -> Type) a b Source #
MuxApplication [MuxMiniProtocol mode m a b] |
data MuxMiniProtocol (mode :: MuxMode) (m :: Type -> Type) a b Source #
MuxMiniProtocol | |
|
data RunMiniProtocol (mode :: MuxMode) (m :: Type -> Type) a b where Source #
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.
Instances
newtype MiniProtocolLimits Source #
Per Miniprotocol limits
MiniProtocolLimits | |
|
data MiniProtocolDir Source #
Instances
Errors
Error type used in across the mux layer.
MuxError | |
|
Instances
data MuxErrorType Source #
Enumeration of error conditions.
MuxUnknownMiniProtocol | returned by |
MuxDecodeError | return by |
MuxBearerClosed | thrown by |
MuxIngressQueueOverRun | thrown by |
MuxInitiatorOnly | thrown when data arrives on a responder channel when the
mux was set up as an |
MuxIOException IOException |
|
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 |
Instances
Show MuxErrorType Source # | |
Defined in Network.Mux.Trace showsPrec :: Int -> MuxErrorType -> ShowS # show :: MuxErrorType -> String # showList :: [MuxErrorType] -> ShowS # | |
Eq MuxErrorType Source # | |
Defined in Network.Mux.Trace (==) :: MuxErrorType -> MuxErrorType -> Bool # (/=) :: MuxErrorType -> MuxErrorType -> Bool # |
Tracing
traceMuxBearerState :: Tracer m MuxTrace -> MuxBearerState -> m () Source #
data MuxBearerState Source #
Mature | MuxBearer has successfully completed the handshake. |
Dead | MuxBearer is dead and the underlying bearer has been closed. |
Instances
Show MuxBearerState Source # | |
Defined in Network.Mux.Trace showsPrec :: Int -> MuxBearerState -> ShowS # show :: MuxBearerState -> String # showList :: [MuxBearerState] -> ShowS # | |
Eq MuxBearerState Source # | |
Defined in Network.Mux.Trace (==) :: MuxBearerState -> MuxBearerState -> Bool # (/=) :: MuxBearerState -> MuxBearerState -> Bool # |
Enumeration of Mux events that can be traced.
MuxTraceRecvHeaderStart | |
MuxTraceRecvHeaderEnd MuxSDUHeader | |
MuxTraceRecvDeltaQObservation MuxSDUHeader Time | |
MuxTraceRecvDeltaQSample Double Int Int Double Double Double Double String | |
MuxTraceRecvStart Int | |
MuxTraceRecvEnd Int | |
MuxTraceSendStart MuxSDUHeader | |
MuxTraceSendEnd | |
MuxTraceState MuxBearerState | |
MuxTraceCleanExit MiniProtocolNum MiniProtocolDir | |
MuxTraceExceptionExit MiniProtocolNum MiniProtocolDir SomeException | |
MuxTraceChannelRecvStart MiniProtocolNum | |
MuxTraceChannelRecvEnd MiniProtocolNum Int | |
MuxTraceChannelSendStart MiniProtocolNum Int | |
MuxTraceChannelSendEnd MiniProtocolNum | |
MuxTraceHandshakeStart | |
MuxTraceHandshakeClientEnd DiffTime | |
MuxTraceHandshakeServerEnd | |
Exception e => MuxTraceHandshakeClientError e DiffTime | |
Exception e => MuxTraceHandshakeServerError e | |
MuxTraceSDUReadTimeoutException | |
MuxTraceSDUWriteTimeoutException | |
MuxTraceStartEagerly MiniProtocolNum MiniProtocolDir | |
MuxTraceStartOnDemand MiniProtocolNum MiniProtocolDir | |
MuxTraceStartedOnDemand MiniProtocolNum MiniProtocolDir | |
MuxTraceTerminating MiniProtocolNum MiniProtocolDir | |
MuxTraceStopping | |
MuxTraceStopped | |
MuxTraceTCPInfo StructTCPInfo Word16 |
data WithMuxBearer peerid a Source #
Type used for tracing mux events.
Instances
Generic (WithMuxBearer peerid a) Source # | |||||
Defined in Network.Mux.Trace
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 # | |||||
Defined in Network.Mux.Trace showsPrec :: Int -> WithMuxBearer peerid a -> ShowS # show :: WithMuxBearer peerid a -> String # showList :: [WithMuxBearer peerid a] -> ShowS # | |||||
type Rep (WithMuxBearer peerid a) Source # | |||||
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))) |