Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type ConnectionManagerState peerAddr handle handleError version (m :: Type -> Type) = ConnMap peerAddr (MutableConnState peerAddr handle handleError version m)
- module Ouroboros.Network.ConnectionManager.ConnMap
- readConnectionStates :: forall (m :: Type -> Type) peerAddr handle handleError version. MonadSTM m => ConnectionManagerState peerAddr handle handleError version m -> STM m (ConnMap peerAddr (ConnectionState peerAddr handle handleError version m))
- readAbstractStateMap :: forall (m :: Type -> Type) peerAddr handle handleError version. MonadSTM m => ConnectionManagerState peerAddr handle handleError version m -> STM m (ConnMap peerAddr AbstractState)
- data MutableConnState peerAddr handle handleError version (m :: Type -> Type) = MutableConnState {
- connStateId :: !ConnStateId
- connVar :: !(StrictTVar m (ConnectionState peerAddr handle handleError version m))
- data ConnStateIdSupply (m :: Type -> Type)
- newtype ConnStateId = ConnStateId Int
- type ConnectionTransitionTrace peerAddr = WithName peerAddr (AbstractTransitionTrace ConnStateId)
- newConnStateIdSupply :: forall (m :: Type -> Type). MonadSTM m => Proxy m -> STM m (ConnStateIdSupply m)
- newMutableConnState :: forall peerAddr handle handleError version (m :: Type -> Type). (MonadTraceSTM m, Typeable peerAddr) => peerAddr -> ConnStateIdSupply m -> ConnectionState peerAddr handle handleError version m -> STM m (MutableConnState peerAddr handle handleError version m)
- data ConnectionState peerAddr handle handleError version (m :: Type -> Type)
- = ReservedOutboundState
- | UnnegotiatedState !Provenance !(ConnectionId peerAddr) (Async m ())
- | OutboundUniState !(ConnectionId peerAddr) !(Async m ()) !handle
- | OutboundDupState !(ConnectionId peerAddr) !(Async m ()) !handle !TimeoutExpired
- | OutboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow
- | InboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow
- | InboundState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow
- | DuplexState !(ConnectionId peerAddr) !(Async m ()) !handle
- | TerminatingState !(ConnectionId peerAddr) !(Async m ()) !(Maybe handleError)
- | TerminatedState !(Maybe handleError)
- abstractState :: forall muxMode peerAddr m a (b :: Type -> Type). MaybeUnknown (ConnectionState muxMode peerAddr m a b) -> AbstractState
- connectionTerminated :: forall peerAddr handle handleError version (m :: Type -> Type). ConnectionState peerAddr handle handleError version m -> Bool
ConnectionManagerState API
type ConnectionManagerState peerAddr handle handleError version (m :: Type -> Type) = ConnMap peerAddr (MutableConnState peerAddr handle handleError version m) Source #
ConnectionManager
state: for each peer we keep a ConnectionState
in
a mutable variable, which reduces congestion on the TMVar
which keeps
ConnectionManagerState
.
Monadic API
readConnectionStates :: forall (m :: Type -> Type) peerAddr handle handleError version. MonadSTM m => ConnectionManagerState peerAddr handle handleError version m -> STM m (ConnMap peerAddr (ConnectionState peerAddr handle handleError version m)) Source #
readAbstractStateMap :: forall (m :: Type -> Type) peerAddr handle handleError version. MonadSTM m => ConnectionManagerState peerAddr handle handleError version m -> STM m (ConnMap peerAddr AbstractState) Source #
MutableConnState
data MutableConnState peerAddr handle handleError version (m :: Type -> Type) Source #
MutableConnState
, which supplies a unique identifier.
TODO: We can get away without id, by tracking connections in
TerminatingState
using a separate priority search queue.
MutableConnState | |
|
Instances
Eq (MutableConnState peerAddr handle handleError version m) Source # | |
Defined in Ouroboros.Network.ConnectionManager.State (==) :: MutableConnState peerAddr handle handleError version m -> MutableConnState peerAddr handle handleError version m -> Bool # (/=) :: MutableConnState peerAddr handle handleError version m -> MutableConnState peerAddr handle handleError version m -> Bool # |
data ConnStateIdSupply (m :: Type -> Type) Source #
A supply of fresh id's.
We use a fresh ids for MutableConnState
.
newtype ConnStateId Source #
A unique identifier of a connection.
It's used even when we don't yet know ConnectionId
.
Instances
type ConnectionTransitionTrace peerAddr = WithName peerAddr (AbstractTransitionTrace ConnStateId) Source #
newConnStateIdSupply :: forall (m :: Type -> Type). MonadSTM m => Proxy m -> STM m (ConnStateIdSupply m) Source #
Create a FreshIdSupply
inside an STM
monad.
newMutableConnState :: forall peerAddr handle handleError version (m :: Type -> Type). (MonadTraceSTM m, Typeable peerAddr) => peerAddr -> ConnStateIdSupply m -> ConnectionState peerAddr handle handleError version m -> STM m (MutableConnState peerAddr handle handleError version m) Source #
ConnectionState
data ConnectionState peerAddr handle handleError version (m :: Type -> Type) Source #
State of a connection.
ReservedOutboundState | Each outbound connections starts in this state. |
UnnegotiatedState !Provenance !(ConnectionId peerAddr) (Async m ()) | Each inbound connection starts in this state, outbound connection
reach this state once note: the async handle is lazy, because it's passed with |
OutboundUniState !(ConnectionId peerAddr) !(Async m ()) !handle |
|
OutboundDupState !(ConnectionId peerAddr) !(Async m ()) !handle !TimeoutExpired | Either |
OutboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow | Before connection is reset it is put in |
InboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow | |
InboundState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow | |
DuplexState !(ConnectionId peerAddr) !(Async m ()) !handle | |
TerminatingState !(ConnectionId peerAddr) !(Async m ()) !(Maybe handleError) | |
TerminatedState !(Maybe handleError) |
Instances
(Show peerAddr, MonadAsync m) => Show (ConnectionState peerAddr handle handleError version m) Source # | |
Defined in Ouroboros.Network.ConnectionManager.State showsPrec :: Int -> ConnectionState peerAddr handle handleError version m -> ShowS # show :: ConnectionState peerAddr handle handleError version m -> String # showList :: [ConnectionState peerAddr handle handleError version m] -> ShowS # |
abstractState :: forall muxMode peerAddr m a (b :: Type -> Type). MaybeUnknown (ConnectionState muxMode peerAddr m a b) -> AbstractState Source #
connectionTerminated :: forall peerAddr handle handleError version (m :: Type -> Type). ConnectionState peerAddr handle handleError version m -> Bool Source #
Return True
for states in which the connection was already closed.