ouroboros-network-framework-0.3.0.0: Ouroboros network framework
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]) 

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

Methods

foldMonoid m ⇒ WithProtocolTemperature pt m → m Source #

foldMapMonoid m ⇒ (a → m) → WithProtocolTemperature pt a → m Source #

foldMap'Monoid m ⇒ (a → m) → WithProtocolTemperature pt a → m Source #

foldr ∷ (a → b → b) → b → WithProtocolTemperature pt a → b Source #

foldr' ∷ (a → b → b) → b → WithProtocolTemperature pt a → b Source #

foldl ∷ (b → a → b) → b → WithProtocolTemperature pt a → b Source #

foldl' ∷ (b → a → b) → b → WithProtocolTemperature pt a → b Source #

foldr1 ∷ (a → a → a) → WithProtocolTemperature pt a → a Source #

foldl1 ∷ (a → a → a) → WithProtocolTemperature pt a → a Source #

toListWithProtocolTemperature pt a → [a] Source #

nullWithProtocolTemperature pt a → Bool Source #

lengthWithProtocolTemperature pt a → Int Source #

elemEq a ⇒ a → WithProtocolTemperature pt a → Bool Source #

maximumOrd a ⇒ WithProtocolTemperature pt a → a Source #

minimumOrd a ⇒ WithProtocolTemperature pt a → a Source #

sumNum a ⇒ WithProtocolTemperature pt a → a Source #

productNum a ⇒ WithProtocolTemperature pt a → a Source #

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 'Established a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

Semigroup a ⇒ Semigroup (WithProtocolTemperature 'Warm a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

Semigroup a ⇒ Semigroup (WithProtocolTemperature 'Hot 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 TemperatureBundle a Source #

A bundle of HotApp, WarmApp and EstablishedApp.

Constructors

TemperatureBundle 

Fields

Instances

Instances details
Functor TemperatureBundle Source # 
Instance details

Defined in Ouroboros.Network.Mux

Applicative TemperatureBundle Source # 
Instance details

Defined in Ouroboros.Network.Mux

Foldable TemperatureBundle Source # 
Instance details

Defined in Ouroboros.Network.Mux

Methods

foldMonoid m ⇒ TemperatureBundle m → m Source #

foldMapMonoid m ⇒ (a → m) → TemperatureBundle a → m Source #

foldMap'Monoid m ⇒ (a → m) → TemperatureBundle a → m Source #

foldr ∷ (a → b → b) → b → TemperatureBundle a → b Source #

foldr' ∷ (a → b → b) → b → TemperatureBundle a → b Source #

foldl ∷ (b → a → b) → b → TemperatureBundle a → b Source #

foldl' ∷ (b → a → b) → b → TemperatureBundle a → b Source #

foldr1 ∷ (a → a → a) → TemperatureBundle a → a Source #

foldl1 ∷ (a → a → a) → TemperatureBundle a → a Source #

toListTemperatureBundle a → [a] Source #

nullTemperatureBundle a → Bool Source #

lengthTemperatureBundle a → Int Source #

elemEq a ⇒ a → TemperatureBundle a → Bool Source #

maximumOrd a ⇒ TemperatureBundle a → a Source #

minimumOrd a ⇒ TemperatureBundle a → a Source #

sumNum a ⇒ TemperatureBundle a → a Source #

productNum a ⇒ TemperatureBundle a → a Source #

Traversable TemperatureBundle Source # 
Instance details

Defined in Ouroboros.Network.Mux

Methods

traverseApplicative f ⇒ (a → f b) → TemperatureBundle a → f (TemperatureBundle b) Source #

sequenceAApplicative f ⇒ TemperatureBundle (f a) → f (TemperatureBundle a) Source #

mapMMonad m ⇒ (a → m b) → TemperatureBundle a → m (TemperatureBundle b) Source #

sequenceMonad m ⇒ TemperatureBundle (m a) → m (TemperatureBundle a) Source #

Eq a ⇒ Eq (TemperatureBundle a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

Show a ⇒ Show (TemperatureBundle a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

Semigroup a ⇒ Semigroup (TemperatureBundle a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

Monoid a ⇒ Monoid (TemperatureBundle a) Source # 
Instance details

Defined in Ouroboros.Network.Mux

type OuroborosBundle (mode ∷ MuxMode) addr bytes m a b = TemperatureBundle (MuxProtocolBundle mode addr bytes m a b) Source #

type MuxBundle (mode ∷ MuxMode) bytes m a b = TemperatureBundle [MiniProtocol mode bytes m a b] Source #

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

newtype MiniProtocolLimits Source #

Per Miniprotocol limits

Constructors

MiniProtocolLimits 

Fields

  • maximumIngressQueueInt

    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 ∷ ∀ (pr ∷ PeerRole) ps (st ∷ ps) failure bytes m a. (Show failure, ∀ (st' ∷ ps). Show (ClientHasAgency st'), ∀ (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 ∷ ∀ (pr ∷ PeerRole) ps (st ∷ ps) failure bytes m a. (Show failure, ∀ (st' ∷ ps). Show (ClientHasAgency st'), ∀ (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 

runMuxPeer ∷ (MonadCatch m, MonadAsync m) ⇒ MuxPeer bytes m a → Channel m bytes → m (a, Maybe bytes) Source #

Run a MuxPeer using either runPeer or runPipelinedPeer.

toApplication ∷ (MonadCatch m, MonadAsync m) ⇒ ConnectionId addr → ControlMessageSTM m → OuroborosApplication mode addr ByteString m a b → MuxApplication mode m a b Source #

mkMuxApplicationBundle ∷ ∀ mode addr bytes m a b. ConnectionId addr → TemperatureBundle (ControlMessageSTM m) → OuroborosBundle mode addr bytes m a b → MuxBundle mode bytes m a b Source #

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

Re-exports

data MuxError Source #

Error type used in across 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 MuxErrorTypeType Source #

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.3.0.0-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
Eq MuxErrorType 
Instance details

Defined in Network.Mux.Trace

Show MuxErrorType 
Instance details

Defined in Network.Mux.Trace