ouroboros-network-framework-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.InboundGovernor.State

Contents

Synopsis

Documentation

newtype InboundGovernorObservableState Source #

Currently only StdGen, but in the future this will be extended to a record which contains some useful statistics about peers to support more advances prune strategies (see. PruneStrategy).

Constructors

InboundGovernorObservableState 

Fields

newObservableStateVar ∷ MonadLabelledSTM m ⇒ StdGen → m (StrictTVar m InboundGovernorObservableState) Source #

Create new observable state StrictTVar.

newObservableStateVarIOIO (StrictTVar IO InboundGovernorObservableState) Source #

Using the global StdGen.

newObservableStateVarFromSeed ∷ MonadLabelledSTM m ⇒ Int → m (StrictTVar m InboundGovernorObservableState) Source #

Useful for testing, it is using mkStdGen.

Internals

data InboundGovernorState muxMode peerAddr m a b Source #

InboundGovernorState, which consist of pure part, and a mutable part. The mutable part can be observable from outside. Future version could contain additional statistics on the peers.

Constructors

InboundGovernorState 

Fields

data ConnectionState muxMode peerAddr m a b Source #

Per connection state tracked by inbound protocol governor.

Constructors

ConnectionState 

Fields

data InboundGovernorCounters Source #

Counters for tracing and analysis purposes

Constructors

InboundGovernorCounters 

Fields

Instances

Instances details
Eq InboundGovernorCounters Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.State

Ord InboundGovernorCounters Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.State

Show InboundGovernorCounters Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.State

Semigroup InboundGovernorCounters Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.State

Monoid InboundGovernorCounters Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.State

unregisterConnectionOrd peerAddr ⇒ ConnectionId peerAddr → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #

Remove connection from InboundGovernorState.

updateMiniProtocolOrd peerAddr ⇒ ConnectionId peerAddr → MiniProtocolNum → STM m (Either SomeException b) → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #

Update a mini-protocol in ConnectionState. Once a mini-protocol was restarted we put the new completion action into csCompletionMap.

data RemoteState m Source #

Each inbound connection is either in RemoteIdle, RemoteCold or RemoteEstablished state. We only need to support PromotedToWarm^{Duplex}_{Remote}, DemotedToCold^{Duplex}_{Remote} and DemotedToCold^{Unidirectional}_{Remote} transitions.

Constructors

RemoteWarm

After PromotedToWarm^{dataFlow}_{Remote} a connection is in RemoteWarm state.

RemoteHot

In this state all established and hot mini-protocols are running and none of the warm mini-protocols is running.

RemoteIdle !(STM m ())

After DemotedToCold^{dataFlow}_{Remote} is detected. This state corresponds to InboundIdleState. In this state we are checking if the responder protocols are idle during protocol idle timeout (represented by an STM action)

RemoteIdle is the initial state of an accepted a connection.

RemoteCold

The RemoteCold state for Duplex connections allows us to have responders started using the on-demand strategy. This assures that once the remote peer start using the connection the local side will be ready to serve it.

For a Duplex connection: a RemoteIdle connection transitions to RemoteCold state after all responders being idle for protocolIdleTimeout. This triggers unregisterInboundConnection.

For a Unidreictional connection: after all responders terminated.

Bundled Patterns

pattern RemoteEstablishedRemoteState m 

updateRemoteStateOrd peerAddr ⇒ ConnectionId peerAddr → RemoteState m → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #

Set csRemoteState for a given connection.

mapRemoteStateOrd peerAddr ⇒ ConnectionId peerAddr → (RemoteState m → RemoteState m) → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #

data MiniProtocolData muxMode m a b Source #

Constructors

MiniProtocolData 

Fields