Safe Haskell | None |
---|---|
Language | Haskell2010 |
Connection manager core types.
Connection manager is responsible for managing uni- and bi-directional connections and threads which are running network applications using 'network-mux'. In particular it is responsible for:
- opening new connection / reusing connections (for bidirectional connections) and exposes a method to register inbound connections;
-
run connection handler, i.e.
ConnectionHandler
, which runs handshake negotiation, notifies connection manager on the results and starts the multiplexer; - error handling for connection threads;
- keeping track of handshake negotiation: whether a unidirectional or duplex connection was negotiated;
- tracking state of each connection;
- keep inbound connections under limits.
Connection manager is designed to work for any
MuxMode
, though the most useful ones are
ResponderMode
and
InitiatorResponderMode
:
-
InitiatorResponderMode
- useful for node-to-node applications, which needs to create outbound connections as well as accept inbound ones; -
ResponderMode
- useful for server side of node-to-client; it allows us to share the same server between node-to-client and node-to-node; -
InitiatorMode
- could be used on client side of node-to-client applications.
The calls
requestOutboundConnection
and
includeInboundConnection
return
once a connection has been negotiated. The returned
handle
contains all
the information that is need to start and monitor mini-protocols through
the mux interface.
For inbound connections, the connection manager will pass handle (also after negotiation).
┌────────────────────────┐ │ │ ┏━━━━━━━━━━━━━━━━┓ ┌──────────────────┐ │ ConnectionHandler │ ┃ ┃ │ │ │ ┝━━━━━━━▶┃ handle ┣━━━━▶│ PeerStateActions ├───▶ P2P Governor │ inbound / outbound │ ┃ ┃ │ │ │ ┃ │ ┗━━┳━━━━━━━━━━━━━┛ └──────────────────┘ └─────────╂──────────────┘ ┃ ┃ ┃ ▼ ┃ ┏━━━━━━━━━━━━━━━━━┓ ┃ ┃ Control Channel ┃ ┃ ┗━━━━━━┳━━━━━━━━━━┛ ┃ ┃ ┃ ┃ ┃ ▼ ┃ ┌────────────────────────┐ ┃ │ │ ┃ │ Server │◀━━━━━━━━━━┛ │ │ └────────────────────────┘
Termination procedure as well as connection state machine is not described in this haddock, see associated specification.
Synopsis
- data AddressType
- data Provenance
-
data
DataFlow
- = Unidirectional
- | Duplex
- data TimeoutExpired
-
data
ConnectionType
- = UnnegotiatedConn ! Provenance
- | InboundIdleConn ! DataFlow
- | OutboundIdleConn ! DataFlow
- | NegotiatedConn ! Provenance ! DataFlow
- | DuplexConn
-
newtype
MaskedAction
m a =
MaskedAction
{
- runWithUnmask :: ( forall x. m x -> m x) -> m a
- type ConnectionHandlerFn handlerTrace socket peerAddr handle handleError version m = socket -> PromiseWriter m ( Either handleError (handle, version)) -> Tracer m handlerTrace -> ConnectionId peerAddr -> ( DiffTime -> socket -> m ( MuxBearer m)) -> MaskedAction m ()
-
data
ConnectionHandler
muxMode handlerTrace socket peerAddr handle handleError version m =
ConnectionHandler
{
- connectionHandler :: WithMuxTuple muxMode ( ConnectionHandlerFn handlerTrace socket peerAddr handle handleError version m)
- data Inactive
-
data
ExceptionInHandler
peerAddr
where
- ExceptionInHandler :: !peerAddr -> ! SomeException -> ExceptionInHandler peerAddr
- data HandleErrorType
- type PrunePolicy peerAddr stm = Map peerAddr ConnectionType -> Int -> stm ( Set peerAddr)
- simplePrunePolicy :: ( Applicative stm, Ord peerAddr) => PrunePolicy peerAddr stm
-
data
ConnectionManager
(muxMode ::
MuxMode
) socket peerAddr handle handleError m =
ConnectionManager
{
- getConnectionManager :: WithMuxMode muxMode ( OutboundConnectionManager muxMode socket peerAddr handle handleError m) ( InboundConnectionManager muxMode socket peerAddr handle handleError m)
- readState :: m ( Map peerAddr AbstractState )
-
data
Connected
peerAddr handle handleError
- = Connected !( ConnectionId peerAddr) ! DataFlow !handle
- | Disconnected !( ConnectionId peerAddr) !( Maybe handleError)
- data OperationResult a
- resultInState :: OperationResult AbstractState -> AbstractState
- data DemotedToColdRemoteTr
- type RequestOutboundConnection peerAddr handle handleError m = peerAddr -> m ( Connected peerAddr handle handleError)
- type IncludeInboundConnection socket peerAddr handle handleError m = Word32 -> socket -> peerAddr -> m ( Connected peerAddr handle handleError)
- requestOutboundConnection :: HasInitiator muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> RequestOutboundConnection peerAddr handle handleError m
- promotedToWarmRemote :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult AbstractState )
- demotedToColdRemote :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult AbstractState )
- unregisterOutboundConnection :: HasInitiator muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult AbstractState )
- includeInboundConnection :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> IncludeInboundConnection socket peerAddr handle handleError m
- unregisterInboundConnection :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult DemotedToColdRemoteTr )
- numberOfConnections :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> STM m Int
-
data
OutboundConnectionManager
(muxMode ::
MuxMode
) socket peerAddr handle handleError m
where
- OutboundConnectionManager :: HasInitiator muxMode ~ True => {..} -> OutboundConnectionManager muxMode socket peerAddr handle handleError m
-
data
InboundConnectionManager
(muxMode ::
MuxMode
) socket peerAddr handle handleError m
where
- InboundConnectionManager :: HasResponder muxMode ~ True => {..} -> InboundConnectionManager muxMode socket peerAddr handle handleError m
-
data
ConnectionManagerError
peerAddr
- = ConnectionExists ! Provenance !peerAddr ! CallStack
- | ForbiddenConnection !( ConnectionId peerAddr) ! CallStack
- | ImpossibleConnection !( ConnectionId peerAddr) ! CallStack
- | ConnectionTerminating !( ConnectionId peerAddr) ! CallStack
- | ConnectionTerminated !peerAddr ! CallStack
- | ImpossibleState !peerAddr ! CallStack
- | ForbiddenOperation !peerAddr ! AbstractState ! CallStack
- | UnknownPeer !peerAddr ! CallStack
- data SomeConnectionManagerError = forall addr.( Typeable addr, Show addr) => SomeConnectionManagerError !( ConnectionManagerError addr)
- data AbstractState
-
data
ConnectionManagerCounters
=
ConnectionManagerCounters
{
- fullDuplexConns :: ! Int
- duplexConns :: ! Int
- unidirectionalConns :: ! Int
- inboundConns :: ! Int
- outboundConns :: ! Int
-
data
WithMuxMode
(mode ::
MuxMode
) a b
where
- WithInitiatorMode :: a -> WithMuxMode InitiatorMode a b
- WithResponderMode :: b -> WithMuxMode ResponderMode a b
- WithInitiatorResponderMode :: a -> b -> WithMuxMode InitiatorResponderMode a b
- withInitiatorMode :: HasInitiator mode ~ True => WithMuxMode mode a b -> a
- withResponderMode :: HasResponder mode ~ True => WithMuxMode mode a b -> b
- newEmptyPromiseIO :: ( MonadSTM m, MonadThrow ( STM m)) => m ( PromiseReader m a, PromiseWriter m a)
-
newtype
PromiseReader
m a =
PromiseReader
{
- readPromise :: STM m a
- readPromiseIO :: MonadSTM m => PromiseReader m a -> m a
-
data
PromiseWriter
m a =
PromiseWriter
{
- writePromise :: a -> STM m ()
- forcePromise :: a -> STM m ()
- data PromiseWriterException = PromiseWriterBlocked
-
data
AssertionLocation
peerAddr
- = UnregisterInboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState
- | RequestOutboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState
- | UnregisterOutboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState
- | PromotedToWarmRemote !( Maybe ( ConnectionId peerAddr)) ! AbstractState
- | DemotedToColdRemote !( Maybe ( ConnectionId peerAddr)) ! AbstractState
-
data
ConnectionManagerTrace
peerAddr handlerTrace
- = TrIncludeConnection Provenance peerAddr
- | TrUnregisterConnection Provenance peerAddr
- | TrConnect ( Maybe peerAddr) peerAddr
- | TrConnectError ( Maybe peerAddr) peerAddr SomeException
- | TrTerminatingConnection Provenance ( ConnectionId peerAddr)
- | TrTerminatedConnection Provenance peerAddr
- | TrConnectionHandler ( ConnectionId peerAddr) handlerTrace
- | TrShutdown
- | TrConnectionExists Provenance peerAddr AbstractState
- | TrForbiddenConnection ( ConnectionId peerAddr)
- | TrImpossibleConnection ( ConnectionId peerAddr)
- | TrConnectionFailure ( ConnectionId peerAddr)
- | TrConnectionNotFound Provenance peerAddr
- | TrForbiddenOperation peerAddr AbstractState
- | TrPruneConnections ( Set peerAddr) Int ( Set peerAddr)
- | TrConnectionCleanup ( ConnectionId peerAddr)
- | TrConnectionTimeWait ( ConnectionId peerAddr)
- | TrConnectionTimeWaitDone ( ConnectionId peerAddr)
- | TrConnectionManagerCounters ConnectionManagerCounters
- | TrState ( Map peerAddr AbstractState )
- | TrUnknownConnection ( ConnectionId peerAddr)
- | TrUnexpectedlyFalseAssertion ( AssertionLocation peerAddr)
- data MaybeUnknown state
- data Transition' state = Transition { }
- type Transition state = Transition' ( MaybeUnknown state)
- type AbstractTransition = Transition' AbstractState
- mkTransition :: state -> state -> Transition state
- type TransitionTrace peerAddr state = TransitionTrace' peerAddr ( MaybeUnknown state)
-
data
TransitionTrace'
peerAddr state =
TransitionTrace
{
- ttPeerAddr :: peerAddr
- ttTransition :: Transition' state
- type AbstractTransitionTrace peerAddr = TransitionTrace' peerAddr AbstractState
Connection manager core types
Connection Types
data AddressType Source #
Connection manager supports
IPv4
and
IPv6
addresses.
Instances
data Provenance Source #
Each connection is is either initiated locally (outbound) or by a remote peer (inbound).
Inbound |
An inbound connection: one that was initiated by a remote peer. |
Outbound |
An outbound connection: one that was initiated by us. |
Instances
Eq Provenance Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: Provenance -> Provenance -> Bool Source # (/=) :: Provenance -> Provenance -> Bool Source # |
|
Ord Provenance Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types compare :: Provenance -> Provenance -> Ordering Source # (<) :: Provenance -> Provenance -> Bool Source # (<=) :: Provenance -> Provenance -> Bool Source # (>) :: Provenance -> Provenance -> Bool Source # (>=) :: Provenance -> Provenance -> Bool Source # max :: Provenance -> Provenance -> Provenance Source # min :: Provenance -> Provenance -> Provenance Source # |
|
Show Provenance Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
Each connection negotiates if it is uni- or bi-directional.
DataFlow
is a life time property of a connection, once negotiated it never changes.
Instances
Eq DataFlow Source # | |
Ord DataFlow Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
|
Show DataFlow Source # | |
data TimeoutExpired Source #
Boolean like type which indicates if the timeout on
OutboundStateDuplex
has expired.
Instances
Eq TimeoutExpired Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: TimeoutExpired -> TimeoutExpired -> Bool Source # (/=) :: TimeoutExpired -> TimeoutExpired -> Bool Source # |
|
Ord TimeoutExpired Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types compare :: TimeoutExpired -> TimeoutExpired -> Ordering Source # (<) :: TimeoutExpired -> TimeoutExpired -> Bool Source # (<=) :: TimeoutExpired -> TimeoutExpired -> Bool Source # (>) :: TimeoutExpired -> TimeoutExpired -> Bool Source # (>=) :: TimeoutExpired -> TimeoutExpired -> Bool Source # max :: TimeoutExpired -> TimeoutExpired -> TimeoutExpired Source # min :: TimeoutExpired -> TimeoutExpired -> TimeoutExpired Source # |
|
Show TimeoutExpired Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
data ConnectionType Source #
Either unnegotiated or negotiated unidirectional or duplex connections.
This is not a static property of a connection. It is used by
PrunePolicy
.
Note: the order matters, it can be used by a
PickPolicy
, e.g.
simplePickPolicy
.
UnnegotiatedConn ! Provenance |
An unnegotiated connection. |
InboundIdleConn ! DataFlow |
An inbound idle connection. |
OutboundIdleConn ! DataFlow |
An outbound idle connection. |
NegotiatedConn ! Provenance ! DataFlow |
A negotiated connection, which is used in only one direction indicated
by
|
DuplexConn |
A connection which is running in full duplex mode. |
Instances
Eq ConnectionType Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: ConnectionType -> ConnectionType -> Bool Source # (/=) :: ConnectionType -> ConnectionType -> Bool Source # |
|
Ord ConnectionType Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types compare :: ConnectionType -> ConnectionType -> Ordering Source # (<) :: ConnectionType -> ConnectionType -> Bool Source # (<=) :: ConnectionType -> ConnectionType -> Bool Source # (>) :: ConnectionType -> ConnectionType -> Bool Source # (>=) :: ConnectionType -> ConnectionType -> Bool Source # max :: ConnectionType -> ConnectionType -> ConnectionType Source # min :: ConnectionType -> ConnectionType -> ConnectionType Source # |
|
Show ConnectionType Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
Connection Handler
ConnectionHandler
provides monadic action which runs handshake
negotiation and starts the multiplexer. It's the component which has access
to underlying socket. There's one-to-one correspondence between sockets and
threads that run the handler.
-
ConnectionHandlerFn
- is the type of callback executed for each connection. All arguments are provided by the connection manager.
-
ConnectionHandler
-
is a newtype wrapper which provides inbound / outbound handlers depending
on
MuxMode
newtype MaskedAction m a Source #
Handler action is started with asynchronous exceptions masked; this allows to install exception handlers in an async-safe way.
MaskedAction | |
|
type ConnectionHandlerFn handlerTrace socket peerAddr handle handleError version m = socket -> PromiseWriter m ( Either handleError (handle, version)) -> Tracer m handlerTrace -> ConnectionId peerAddr -> ( DiffTime -> socket -> m ( MuxBearer m)) -> MaskedAction m () Source #
MaskedAction which is executed by thread designated for a given connection.
PromiseWriter
allows to notify the
ConnectionManager
about the result of
handshake negotiation.
Note:
PromiseWriter
could be replaced with an stm action which is
accessing the
TVar
which holds state of the connection.
data ConnectionHandler muxMode handlerTrace socket peerAddr handle handleError version m Source #
Connection handler action. It is index by
muxMode ::
.
There's one
MuxMode
ConnectionHandlerFn
per provenance, possibly limited by
muxMode
.
ConnectionHandler | |
|
data ExceptionInHandler peerAddr where Source #
Exception which where caught in the connection thread and were re-thrown
in the main thread by the
rethrowPolicy
.
ExceptionInHandler :: !peerAddr -> ! SomeException -> ExceptionInHandler peerAddr |
Instances
Show peerAddr => Show ( ExceptionInHandler peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
|
( Show peerAddr, Typeable peerAddr) => Exception ( ExceptionInHandler peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types toException :: ExceptionInHandler peerAddr -> SomeException Source # fromException :: SomeException -> Maybe ( ExceptionInHandler peerAddr) Source # displayException :: ExceptionInHandler peerAddr -> String Source # |
data HandleErrorType Source #
Data type used to classify
handleErrors
.
HandshakeFailure |
Handshake negotiation failed. This is not a protocol error. |
HandshakeProtocolViolation |
Handshake protocol error. This should include timeout errors or any IO errors. |
Prune Policy
type PrunePolicy peerAddr stm = Map peerAddr ConnectionType -> Int -> stm ( Set peerAddr) Source #
PrunePolicy
allows to pick a select peers from which we will disconnect
(we use
TCP
reset). The chosen connections will be terminated by the
connection manger once it detects that there are too many inbound
connections.
simplePrunePolicy :: ( Applicative stm, Ord peerAddr) => PrunePolicy peerAddr stm Source #
The simplest
PrunePolicy
, it should only be used for tests.
Connection Manager
Connection Manager Arguments
data ConnectionManager (muxMode :: MuxMode ) socket peerAddr handle handleError m Source #
We identify resources (e.g.
Socket
or
HANDLE
) by their address. It is enough for us to use
just the remote address rather than connection identifier, since we need one
connection towards that peer, even if we are connected through multiple
local addresses. It is safe to share a connection manager with multiple
listening sockets.
ConnectionManager | |
|
API
data Connected peerAddr handle handleError Source #
Result of
requestOutboundConnection
or
includeInboundConnection
.
Connected !( ConnectionId peerAddr) ! DataFlow !handle |
We are connected and mux is running. |
Disconnected !( ConnectionId peerAddr) !( Maybe handleError) |
There was an error during handshake negotiation.
Implementation detail:
we return
|
data OperationResult a Source #
Custom either type for result of various methods.
Instances
Functor OperationResult Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types fmap :: (a -> b) -> OperationResult a -> OperationResult b Source # (<$) :: a -> OperationResult b -> OperationResult a Source # |
|
Show a => Show ( OperationResult a) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
data DemotedToColdRemoteTr Source #
Return value of
unregisterInboundConnection
to inform the caller about
the transition.
CommitTr |
|
KeepTr |
Either
|
Instances
type RequestOutboundConnection peerAddr handle handleError m = peerAddr -> m ( Connected peerAddr handle handleError) Source #
type IncludeInboundConnection socket peerAddr handle handleError m Source #
Outbound side
requestOutboundConnection :: HasInitiator muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> RequestOutboundConnection peerAddr handle handleError m Source #
Include outbound connection into
ConnectionManager
.
This executes:
- \(Reserve\) to \(Negotiated^{*}_{Outbound}\) transitions
- \(PromotedToWarm^{Duplex}_{Local}\) transition
- \(Awake^{Duplex}_{Local}\) transition
promotedToWarmRemote :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult AbstractState ) Source #
Notify the
ConnectionManager
that a remote end promoted us to a
warm peer
.
This executes either:
- \(PromotedToWarm^{Duplex}_{Remote}\) transition,
- \(Awake^{*}_{Remote}\) transition
from the specification.
demotedToColdRemote :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult AbstractState ) Source #
Notify the
ConnectionManager
that a remote end demoted us to a /cold
peer/.
This executes:
- \(DemotedToCold^{*}_{Remote}\) transition.
This method is idempotent.
unregisterOutboundConnection Source #
:: HasInitiator muxMode ~ True | |
=> ConnectionManager muxMode socket peerAddr handle handleError m | |
-> peerAddr | |
-> m ( OperationResult AbstractState ) |
reports the from-state. |
Unregister outbound connection.
This executes:
- \(DemotedToCold^{*}_{Local}\) transitions
Inbound side
includeInboundConnection :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> IncludeInboundConnection socket peerAddr handle handleError m Source #
Include an inbound connection into
ConnectionManager
.
This executes:
- \(Reserve\) to \(Negotiated^{*}_{Outbound}\) transitions
- \(PromotedToWarm^{Duplex}_{Local}\) transition
- \(Awake^{Duplex}_{Local}\) transition
unregisterInboundConnection :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> peerAddr -> m ( OperationResult DemotedToColdRemoteTr ) Source #
Unregister outbound connection. Returns if the operation was successul.
This executes:
- \(Commit*{*}\) transition
- \(TimeoutExpired\) transition
numberOfConnections :: HasResponder muxMode ~ True => ConnectionManager muxMode socket peerAddr handle handleError m -> STM m Int Source #
Number of connections tracked by the server.
Private API
data OutboundConnectionManager (muxMode :: MuxMode ) socket peerAddr handle handleError m where Source #
Outbound connection manager API.
OutboundConnectionManager | |
|
data InboundConnectionManager (muxMode :: MuxMode ) socket peerAddr handle handleError m where Source #
Inbound connection manager API. For a server implementation we also need to know how many connections are now managed by the connection manager.
This type is an internal detail of
ConnectionManager
InboundConnectionManager | |
|
Exceptions
data ConnectionManagerError peerAddr Source #
Exceptions used by
ConnectionManager
.
ConnectionExists ! Provenance !peerAddr ! CallStack |
A connection manager was asked for an outbound connection and there either exists a connection used in outbound direction or a reservation for an outbound connection. |
ForbiddenConnection !( ConnectionId peerAddr) ! CallStack |
Connection manager was asked for an outbound connection which turned out to be unidirectional inbound, and thus it cannot be re-used.. |
ImpossibleConnection !( ConnectionId peerAddr) ! CallStack |
Connections that would be forbidden by the kernel (
|
ConnectionTerminating !( ConnectionId peerAddr) ! CallStack |
Connection is now terminating. |
ConnectionTerminated !peerAddr ! CallStack |
Connection has terminated. |
ImpossibleState !peerAddr ! CallStack |
Connection manager in impossible state. |
ForbiddenOperation !peerAddr ! AbstractState ! CallStack |
A forbidden operation in the given connection state. |
UnknownPeer !peerAddr ! CallStack |
A connection does not exists. Only thrown when an existing connection was expected. |
Instances
Show peerAddr => Show ( ConnectionManagerError peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
|
( Show peerAddr, Typeable peerAddr) => Exception ( ConnectionManagerError peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types toException :: ConnectionManagerError peerAddr -> SomeException Source # fromException :: SomeException -> Maybe ( ConnectionManagerError peerAddr) Source # displayException :: ConnectionManagerError peerAddr -> String Source # |
data SomeConnectionManagerError Source #
Existential wrapper for
. It allows to
use
ConnectionManagerError
peerAddr
fromException
, without being bothered about the address type.
forall addr.( Typeable addr, Show addr) => SomeConnectionManagerError !( ConnectionManagerError addr) |
data AbstractState Source #
Useful for tracing and error messages.
Instances
Eq AbstractState Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: AbstractState -> AbstractState -> Bool Source # (/=) :: AbstractState -> AbstractState -> Bool Source # |
|
Ord AbstractState Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types compare :: AbstractState -> AbstractState -> Ordering Source # (<) :: AbstractState -> AbstractState -> Bool Source # (<=) :: AbstractState -> AbstractState -> Bool Source # (>) :: AbstractState -> AbstractState -> Bool Source # (>=) :: AbstractState -> AbstractState -> Bool Source # max :: AbstractState -> AbstractState -> AbstractState Source # min :: AbstractState -> AbstractState -> AbstractState Source # |
|
Show AbstractState Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
Counters
data ConnectionManagerCounters Source #
Counters for tracing and analysis purposes
ConnectionManagerCounters | |
|
Instances
Mux types
data WithMuxMode (mode :: MuxMode ) a b where Source #
WithInitiatorMode :: a -> WithMuxMode InitiatorMode a b | |
WithResponderMode :: b -> WithMuxMode ResponderMode a b | |
WithInitiatorResponderMode :: a -> b -> WithMuxMode InitiatorResponderMode a b |
withInitiatorMode :: HasInitiator mode ~ True => WithMuxMode mode a b -> a Source #
withResponderMode :: HasResponder mode ~ True => WithMuxMode mode a b -> b Source #
Promise
Promise interface, backed by a
StrictTMVar
.
Making two separate interfaces:
PromiseWriter
and
PromiseReader
allows us
to make a clear distinction between consumer and producers threads.
newEmptyPromiseIO :: ( MonadSTM m, MonadThrow ( STM m)) => m ( PromiseReader m a, PromiseWriter m a) Source #
newtype PromiseReader m a Source #
PromiseReader | |
|
readPromiseIO :: MonadSTM m => PromiseReader m a -> m a Source #
data PromiseWriter m a Source #
PromiseWriter | |
|
data PromiseWriterException Source #
Instances
Tracing
data AssertionLocation peerAddr Source #
AssertionLocation
contains constructors that situate the location of the tracing so
one can be sure where the assertion came from as well as the all relevant information.
UnregisterInboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState | |
RequestOutboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState | |
UnregisterOutboundConnection !( Maybe ( ConnectionId peerAddr)) ! AbstractState | |
PromotedToWarmRemote !( Maybe ( ConnectionId peerAddr)) ! AbstractState | |
DemotedToColdRemote !( Maybe ( ConnectionId peerAddr)) ! AbstractState |
Instances
Show peerAddr => Show ( AssertionLocation peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
data ConnectionManagerTrace peerAddr handlerTrace Source #
ConnectionManagerTrace
contains a hole for a trace of single connection
which is filled with
ConnectionHandlerTrace
.
Instances
( Show peerAddr, Show handlerTrace) => Show ( ConnectionManagerTrace peerAddr handlerTrace) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
data MaybeUnknown state Source #
A custom version of
Maybe
type, which allows to explicitly represent
connections which are not registered by the connection manager.
Known !state |
Known connection in
|
Race !state |
There is a possible race condition between connection finalizer and
either inbound or outbound connection registration. If that happens we
use
|
Unknown |
Connection is is not known to the connection manager. |
Instances
Functor MaybeUnknown Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types fmap :: (a -> b) -> MaybeUnknown a -> MaybeUnknown b Source # (<$) :: a -> MaybeUnknown b -> MaybeUnknown a Source # |
|
Show state => Show ( MaybeUnknown state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
data Transition' state Source #
Instances
Functor Transition' Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types fmap :: (a -> b) -> Transition' a -> Transition' b Source # (<$) :: a -> Transition' b -> Transition' a Source # |
|
Eq state => Eq ( Transition' state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: Transition' state -> Transition' state -> Bool Source # (/=) :: Transition' state -> Transition' state -> Bool Source # |
|
Show state => Show ( Transition' state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
type Transition state = Transition' ( MaybeUnknown state) Source #
mkTransition :: state -> state -> Transition state Source #
type TransitionTrace peerAddr state = TransitionTrace' peerAddr ( MaybeUnknown state) Source #
data TransitionTrace' peerAddr state Source #
TransitionTrace | |
|
Instances
Functor ( TransitionTrace' peerAddr) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types fmap :: (a -> b) -> TransitionTrace' peerAddr a -> TransitionTrace' peerAddr b Source # (<$) :: a -> TransitionTrace' peerAddr b -> TransitionTrace' peerAddr a Source # |
|
( Show peerAddr, Show state) => Show ( TransitionTrace' peerAddr state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types |
type AbstractTransitionTrace peerAddr = TransitionTrace' peerAddr AbstractState Source #