Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.Mux
Contents
Synopsis
- data MuxMode where
- newtype OuroborosApplication (mode ∷ MuxMode) addr bytes m a b = 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]
- data ProtocolTemperature
- = Established
- | Warm
- | Hot
- data SingProtocolTemperature (pt ∷ ProtocolTemperature) where
- data SomeTokProtocolTemperature where
- data WithProtocolTemperature (pt ∷ ProtocolTemperature) a where
- WithHot ∷ !a → WithProtocolTemperature Hot a
- WithWarm ∷ !a → WithProtocolTemperature Warm a
- WithEstablished ∷ !a → WithProtocolTemperature Established a
- withoutProtocolTemperature ∷ WithProtocolTemperature pt a → a
- data WithSomeProtocolTemperature a where
- withoutSomeProtocolTemperature ∷ WithSomeProtocolTemperature a → a
- data TemperatureBundle a = TemperatureBundle {}
- projectBundle ∷ SingProtocolTemperature pt → TemperatureBundle a → a
- type OuroborosBundle (mode ∷ MuxMode) addr bytes m a b = TemperatureBundle (MuxProtocolBundle mode addr bytes m a b)
- type MuxBundle (mode ∷ MuxMode) bytes m a b = TemperatureBundle [MiniProtocol mode bytes m a b]
- data MiniProtocol (mode ∷ MuxMode) bytes m a b = MiniProtocol {
- miniProtocolNum ∷ !MiniProtocolNum
- miniProtocolLimits ∷ !MiniProtocolLimits
- miniProtocolRun ∷ !(RunMiniProtocol mode bytes m a b)
- newtype MiniProtocolNum = MiniProtocolNum Word16
- newtype MiniProtocolLimits = MiniProtocolLimits {}
- data RunMiniProtocol (mode ∷ MuxMode) bytes m a b where
- InitiatorProtocolOnly ∷ MuxPeer bytes m a → RunMiniProtocol InitiatorMode bytes m a Void
- ResponderProtocolOnly ∷ MuxPeer bytes m b → RunMiniProtocol ResponderMode bytes m Void b
- InitiatorAndResponderProtocol ∷ MuxPeer bytes m a → MuxPeer bytes m b → RunMiniProtocol InitiatorResponderMode bytes m a b
- data MuxPeer bytes m a where
- 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)
- toApplication ∷ (MonadCatch m, MonadAsync m) ⇒ ConnectionId addr → ControlMessageSTM m → OuroborosApplication mode addr ByteString m a b → MuxApplication mode m a b
- 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
- mkMiniProtocolBundle ∷ MuxBundle mode bytes m a b → MiniProtocolBundle mode
- data MuxError = MuxError {}
- data MuxErrorType
- type family HasInitiator (mode ∷ MuxMode) ∷ Bool where ...
- type family HasResponder (mode ∷ MuxMode) ∷ Bool where ...
Documentation
Constructors
InitiatorMode ∷ MuxMode | |
ResponderMode ∷ MuxMode | |
InitiatorResponderMode ∷ MuxMode |
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 ProtocolTemperature Source #
There are three kinds of applications: warm, hot and established (ones that run in both warm and hot peers).
Constructors
Established | |
Warm | |
Hot |
Instances
data SingProtocolTemperature (pt ∷ ProtocolTemperature) where Source #
Singletons for ProtocolTemperature
.
data SomeTokProtocolTemperature where Source #
Constructors
SomeTokProtocolTemperature ∷ SingProtocolTemperature pt → SomeTokProtocolTemperature |
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.
Constructors
WithHot ∷ !a → WithProtocolTemperature Hot a | |
WithWarm ∷ !a → WithProtocolTemperature Warm a | |
WithEstablished ∷ !a → WithProtocolTemperature Established a |
Instances
withoutProtocolTemperature ∷ WithProtocolTemperature pt a → a Source #
data WithSomeProtocolTemperature a where Source #
Constructors
WithSomeProtocolTemperature ∷ WithProtocolTemperature pt a → WithSomeProtocolTemperature a |
Instances
Functor WithSomeProtocolTemperature Source # | |
Defined in Ouroboros.Network.Mux Methods fmap ∷ (a → b) → WithSomeProtocolTemperature a → WithSomeProtocolTemperature b Source # (<$) ∷ a → WithSomeProtocolTemperature b → WithSomeProtocolTemperature a Source # | |
Show a ⇒ Show (WithSomeProtocolTemperature a) Source # | |
Defined in Ouroboros.Network.Mux |
data TemperatureBundle a Source #
A bundle of HotApp
, WarmApp
and EstablishedApp
.
Constructors
TemperatureBundle | |
Fields
|
Instances
projectBundle ∷ SingProtocolTemperature pt → TemperatureBundle a → a Source #
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 #
Constructors
MiniProtocol | |
Fields
|
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
newtype MiniProtocolLimits Source #
Per Miniprotocol limits
Constructors
MiniProtocolLimits | |
Fields
|
data RunMiniProtocol (mode ∷ MuxMode) bytes m a b where Source #
Constructors
InitiatorProtocolOnly ∷ MuxPeer bytes m a → RunMiniProtocol InitiatorMode bytes m a Void | |
ResponderProtocolOnly ∷ MuxPeer bytes m b → RunMiniProtocol ResponderMode bytes m Void b | |
InitiatorAndResponderProtocol ∷ MuxPeer bytes m a → MuxPeer bytes m b → RunMiniProtocol InitiatorResponderMode bytes m a b |
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
using either MuxPeer
or runPeer
.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 #
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.
Re-exports
from Network.Mux
Error type used in across the mux layer.
Constructors
MuxError | |
Fields
|
Instances
Show MuxError | |
Generic MuxError | |
Exception MuxError | |
Defined in Network.Mux.Trace Methods toException ∷ MuxError → SomeException Source # | |
type Rep MuxError | |
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 |
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
Eq MuxErrorType | |
Defined in Network.Mux.Trace Methods (==) ∷ MuxErrorType → MuxErrorType → Bool Source # (/=) ∷ MuxErrorType → MuxErrorType → Bool Source # | |
Show MuxErrorType | |
Defined in Network.Mux.Trace |
type family HasInitiator (mode ∷ MuxMode) ∷ Bool where ... Source #
Equations
HasInitiator 'InitiatorMode = 'True | |
HasInitiator 'ResponderMode = 'False | |
HasInitiator 'InitiatorResponderMode = 'True |
type family HasResponder (mode ∷ MuxMode) ∷ Bool where ... Source #
Equations
HasResponder 'InitiatorMode = 'False | |
HasResponder 'ResponderMode = 'True | |
HasResponder 'InitiatorResponderMode = 'True |