ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.ConnectionManager.State

Synopsis

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.

Constructors

MutableConnState 

Fields

Instances

Instances details
Eq (MutableConnState peerAddr handle handleError version m) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.State

Methods

(==) :: 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.

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.

Constructors

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 connect call returns.

note: the async handle is lazy, because it's passed with mfix.

OutboundUniState !(ConnectionId peerAddr) !(Async m ()) !handle

OutboundState Unidirectional state.

OutboundDupState !(ConnectionId peerAddr) !(Async m ()) !handle !TimeoutExpired

Either OutboundState Duplex or OutboundState^tau Duplex.

OutboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow

Before connection is reset it is put in OutboundIdleState for the duration of outboundIdleTimeout.

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

Instances details
(Show peerAddr, MonadAsync m) => Show (ConnectionState peerAddr handle handleError version m) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.State

Methods

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.