ouroboros-network-framework-0.1.0.1
Safe Haskell None
Language Haskell2010

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])

type MuxProtocolBundle (mode :: MuxMode ) addr bytes m a b = ConnectionId addr -> ControlMessageSTM m -> [ MiniProtocol mode bytes m a b] Source #

data WithProtocolTemperature (pt :: ProtocolTemperature ) a where Source #

We keep hot, warm and established application (or their context) distinct. It's only needed for a handly projectBundle map.

Instances

Instances details
Functor ( WithProtocolTemperature pt) Source #
Instance details

Defined in Ouroboros.Network.Mux

Applicative ( WithProtocolTemperature ' Established ) Source #
Instance details

Defined in Ouroboros.Network.Mux

Applicative ( WithProtocolTemperature ' Warm ) Source #
Instance details

Defined in Ouroboros.Network.Mux

Applicative ( WithProtocolTemperature ' Hot ) Source #
Instance details

Defined in Ouroboros.Network.Mux

Foldable ( WithProtocolTemperature pt) Source #
Instance details

Defined in Ouroboros.Network.Mux

Traversable ( WithProtocolTemperature pt) Source #
Instance details

Defined in Ouroboros.Network.Mux

Eq a => Eq ( WithProtocolTemperature pt a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Show a => Show ( WithProtocolTemperature pt a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Semigroup a => Semigroup ( WithProtocolTemperature pt a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Monoid a => Monoid ( WithProtocolTemperature ' Established a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Monoid a => Monoid ( WithProtocolTemperature ' Warm a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Monoid a => Monoid ( WithProtocolTemperature ' Hot a) Source #
Instance details

Defined in Ouroboros.Network.Mux

data Bundle a Source #

A bundle of HotApp , WarmApp and EstablishedApp .

Constructors

Bundle

Fields

Instances

Instances details
Functor Bundle Source #
Instance details

Defined in Ouroboros.Network.Mux

Applicative Bundle Source #
Instance details

Defined in Ouroboros.Network.Mux

Foldable Bundle Source #
Instance details

Defined in Ouroboros.Network.Mux

Traversable Bundle Source #
Instance details

Defined in Ouroboros.Network.Mux

Eq a => Eq ( Bundle a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Show a => Show ( Bundle a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Semigroup a => Semigroup ( Bundle a) Source #
Instance details

Defined in Ouroboros.Network.Mux

Monoid a => Monoid ( Bundle a) Source #
Instance details

Defined in Ouroboros.Network.Mux

type OuroborosBundle (mode :: MuxMode ) addr bytes m a b = Bundle ( MuxProtocolBundle mode addr bytes m a b) Source #

type MuxBundle (mode :: MuxMode ) bytes m a b = Bundle [ MiniProtocol mode 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.

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

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

mkMuxApplicationBundle :: forall mode addr bytes m a b. ConnectionId addr -> Bundle ( ControlMessageSTM m) -> OuroborosBundle mode addr bytes m a b -> MuxBundle mode bytes m a b Source #

mkMiniProtocolBundle :: MuxBundle mode bytes m a b -> MiniProtocolBundle mode Source #

Make MiniProtocolBundle , which is used to create a mux interface with newMux . The output of mkMuxApplicationBundle can be used as input.

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.

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