ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.InboundGovernor.Event

Synopsis

Documentation

data Event (muxMode :: Mode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b Source #

Edge triggered events to which the inbound protocol governor reacts.

Constructors

NewConnection !(NewConnectionInfo peerAddr (Handle muxMode initiatorCtx (ResponderContext peerAddr) versionData ByteString m a b))

A request to start mini-protocol bundle, either from the server or from connection manager after a duplex connection was negotiated.

MuxFinished !(ConnectionId peerAddr) !(Maybe SomeException)

A multiplexer exited.

MiniProtocolTerminated !(Terminated muxMode initiatorCtx peerAddr m a b)

A mini-protocol terminated either cleanly or abruptly.

WaitIdleRemote !(ConnectionId peerAddr)

Transition from RemoteEstablished to RemoteIdle.

RemotePromotedToHot !(ConnectionId peerAddr)

A remote warm → hot transition. It is scheduled as soon as all hot mini-protocols are running.

RemoteDemotedToWarm !(ConnectionId peerAddr)

A hot → warm transition. It is scheduled as soon as any hot mini-protocol terminates.

CommitRemote !(ConnectionId peerAddr)

Transition from RemoteIdle to RemoteCold.

AwakeRemote !(ConnectionId peerAddr)

Transition from RemoteIdle or RemoteCold to RemoteEstablished.

MaturedDuplexPeers

Update igsMatureDuplexPeers and igsFreshDuplexPeers.

Fields

  • !(Map peerAddr versionData)

    newly matured duplex peers

  • !(OrdPSQ peerAddr Time versionData)

    queue of fresh duplex peers

InactivityTimeout 

type EventSignal (muxMode :: Mode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b = ConnectionId peerAddr -> ConnectionState muxMode initiatorCtx peerAddr versionData m a b -> FirstToFinish (STM m) (Event muxMode initiatorCtx peerAddr versionData m a b) Source #

A signal which returns an Event. Signals are combined together and passed used to fold the current state map.

firstMuxToFinish :: forall (m :: Type -> Type) (muxMode :: Mode) initiatorCtx peerAddr versionData a b. MonadSTM m => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

A mux stopped. If mux exited cleanly no error is attached.

data Terminated (muxMode :: Mode) initiatorCtx peerAddr (m :: Type -> Type) a b Source #

When a mini-protocol terminates we take Terminated out of 'ConnectionState and pass it to the main loop. This is just enough to decide if we need to restart a mini-protocol and to do the restart.

Constructors

Terminated 

Fields

firstMiniProtocolToFinish :: forall (m :: Type -> Type) versionData (muxMode :: Mode) initiatorCtx peerAddr a b. Alternative (STM m) => (versionData -> DataFlow) -> EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

Detect when one of the mini-protocols terminated.

triggers: MiniProtocolTerminated.

firstPeerPromotedToWarm :: forall (muxMode :: Mode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b. (Alternative (STM m), MonadSTM m) => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

Detect when one of the peers was promoted to warm, e.g. PromotedToWarm^{Duplex}_{Remote} or PromotedToWarm^{Unidirectional}_{Remote}.

triggers: PromotedToWarm

Note: The specification only describes PromotedToWarm^{Duplex}_{Remote} transition, but here we don't make a distinction on Duplex and Unidirectional connections.

firstPeerPromotedToHot :: forall (muxMode :: Mode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b. (Alternative (STM m), MonadSTM m) => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

Detect when a first warm peer is promoted to hot (any hot mini-protocols is running).

firstPeerDemotedToWarm :: forall (muxMode :: Mode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b. (Alternative (STM m), MonadSTM m) => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

Detect when all hot mini-protocols terminates, which triggers the `RemoteHot → RemoteWarm` transition.

firstPeerDemotedToCold :: forall (m :: Type -> Type) (muxMode :: Mode) initiatorCtx peerAddr versionData a b. (Alternative (STM m), MonadSTM m) => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

Await for first peer demoted to cold, i.e. detect the DemotedToCold^{Duplex}_{Remote}.

triggers: DemotedToColdRemote

firstPeerCommitRemote :: forall (m :: Type -> Type) (muxMode :: Mode) initiatorCtx peerAddr versionData a b. Alternative (STM m) => EventSignal muxMode initiatorCtx peerAddr versionData m a b Source #

First peer for which the RemoteIdle timeout expires.

data NewConnectionInfo peerAddr handle Source #

Announcement message for a new connection.

Constructors

NewConnectionInfo !Provenance !(ConnectionId peerAddr) !DataFlow !handle

Announce a new connection. Inbound protocol governor will start responder protocols using StartOnDemand strategy and monitor remote transitions: PromotedToWarm^{Duplex}_{Remote} and DemotedToCold^{dataFlow}_{Remote}.

Instances

Instances details
Show peerAddr => Show (NewConnectionInfo peerAddr handle) Source # 
Instance details

Defined in Ouroboros.Network.InboundGovernor.Event

Methods

showsPrec :: Int -> NewConnectionInfo peerAddr handle -> ShowS #

show :: NewConnectionInfo peerAddr handle -> String #

showList :: [NewConnectionInfo peerAddr handle] -> ShowS #