ouroboros-network-framework-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Mux

Contents

Synopsis

Documentation

newtype OuroborosApplication (mode :: MuxMode) addr bytes m a b Source #

Like MuxApplication but using a MuxPeer rather than a raw Channel -> m a action.

Constructors

OuroborosApplication (ConnectionId addr -> ControlMessageSTM m -> [MiniProtocol mode bytes m a b]) 

data MiniProtocol (mode :: MuxMode) bytes m a b Source #

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 
Instance details

Defined in Network.Mux.Types

Eq MiniProtocolNum 
Instance details

Defined in Network.Mux.Types

Ord MiniProtocolNum 
Instance details

Defined in Network.Mux.Types

Show MiniProtocolNum 
Instance details

Defined in Network.Mux.Types

Ix MiniProtocolNum 
Instance details

Defined in Network.Mux.Types

data 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 RunMiniProtocol (mode :: MuxMode) bytes m a b where Source #

data MuxPeer bytes m a where Source #

Constructors

MuxPeer :: forall (pr :: PeerRole) ps (st :: ps) failure bytes m a. (Show failure, forall (st' :: ps). Show (ClientHasAgency st'), forall (st' :: ps). Show (ServerHasAgency st'), ShowProxy ps) => Tracer m (TraceSendRecv ps) -> Codec ps failure m bytes -> Peer ps pr st m a -> MuxPeer bytes m a 
MuxPeerPipelined :: forall (pr :: PeerRole) ps (st :: ps) failure bytes m a. (Show failure, forall (st' :: ps). Show (ClientHasAgency st'), forall (st' :: ps). Show (ServerHasAgency st'), ShowProxy ps) => Tracer m (TraceSendRecv ps) -> Codec ps failure m bytes -> PeerPipelined ps pr st m a -> MuxPeer bytes m a 
MuxPeerRaw :: (Channel m bytes -> m (a, Maybe bytes)) -> MuxPeer bytes m a 

data ControlMessage Source #

Control signal sent to a mini-protocol. expected to exit, on Continue it should continue its operation

Constructors

Continue

Continue operation.

Quiesce

Hold on, e.g. do not sent messages until resumed. This is not used for any hot protocol.

Terminate

The client is expected to terminate as soon as possible.

Instances

Instances details
Eq ControlMessage Source # 
Instance details

Defined in Ouroboros.Network.Mux

Show ControlMessage Source # 
Instance details

Defined in Ouroboros.Network.Mux

type ControlMessageSTM m = STM m ControlMessage Source #

ControlMessageSTM should depend on muxMode (we only need to shedule stop for intiator side). This is not done only because this would break tests, but once the old api is removed it should be possible.

timeoutWithControlMessage :: MonadSTM m => ControlMessageSTM m -> STM m a -> m (Maybe a) Source #

First to finish synchronisation between Terminate state of ControlMessage and an stm action.

This should return STM m (Maybe a) but STM is a non-injective type family, and we would need to pass Proxy m to fix an ambiuous type (or use AllowAmbiguousTypes extension).

Re-exports

data MuxError Source #

Error type used in accross the mux layer.

Constructors

MuxError 

Instances

Instances details
Show MuxError 
Instance details

Defined in Network.Mux.Trace

Generic MuxError 
Instance details

Defined in Network.Mux.Trace

Associated Types

type Rep MuxError :: Type -> Type #

Methods

from :: MuxError -> Rep MuxError x #

to :: Rep MuxError x -> MuxError #

Exception MuxError 
Instance details

Defined in Network.Mux.Trace

type Rep MuxError 
Instance details

Defined in Network.Mux.Trace

type Rep MuxError = D1 ('MetaData "MuxError" "Network.Mux.Trace" "network-mux-0.1.0.0-9lGOxxFsgpyBkmgq5iX8kU" '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.

MuxCleanShutdown

Mux stopped by stopMux

MuxBlockedOnCompletionVar !MiniProtocolNum

Mux blocked on completionVar.

Instances

Instances details
Eq MuxErrorType 
Instance details

Defined in Network.Mux.Trace

Show MuxErrorType 
Instance details

Defined in Network.Mux.Trace