Safe Haskell | None |
---|---|
Language | Haskell2010 |
Server implementation based on ConnectionManager
Synopsis
- data PublicInboundGovernorState peerAddr versionData = PublicInboundGovernorState {
- inboundDuplexPeers :: !(Map peerAddr versionData)
- remoteStateMap :: Map (ConnectionId peerAddr) RemoteSt
- withInboundGovernor :: forall (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber m a b x. (Alternative (STM m), MonadAsync m, MonadCatch m, MonadEvaluate m, MonadLabelledSTM m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ 'True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> Tracer m (DebugInboundGovernor peerAddr) -> InboundGovernorInfoChannel muxMode initiatorCtx peerAddr versionData ByteString m a b -> Maybe DiffTime -> MuxConnectionManager muxMode socket initiatorCtx (ResponderContext peerAddr) peerAddr versionData versionNumber ByteString m a b -> (Async m Void -> m (PublicInboundGovernorState peerAddr versionData) -> m x) -> m x
- data InboundGovernorTrace peerAddr
- = TrNewConnection !Provenance !(ConnectionId peerAddr)
- | TrResponderRestarted !(ConnectionId peerAddr) !MiniProtocolNum
- | TrResponderStartFailure !(ConnectionId peerAddr) !MiniProtocolNum !SomeException
- | TrResponderErrored !(ConnectionId peerAddr) !MiniProtocolNum !SomeException
- | TrResponderStarted !(ConnectionId peerAddr) !MiniProtocolNum
- | TrResponderTerminated !(ConnectionId peerAddr) !MiniProtocolNum
- | TrPromotedToWarmRemote !(ConnectionId peerAddr) !(OperationResult AbstractState)
- | TrPromotedToHotRemote !(ConnectionId peerAddr)
- | TrDemotedToWarmRemote !(ConnectionId peerAddr)
- | TrDemotedToColdRemote !(ConnectionId peerAddr) !(OperationResult DemotedToColdRemoteTr)
- | TrWaitIdleRemote !(ConnectionId peerAddr) !(OperationResult AbstractState)
- | TrMuxCleanExit !(ConnectionId peerAddr)
- | TrMuxErrored !(ConnectionId peerAddr) SomeException
- | TrInboundGovernorCounters !InboundGovernorCounters
- | TrRemoteState !(Map (ConnectionId peerAddr) RemoteSt)
- | TrUnexpectedlyFalseAssertion !(IGAssertionLocation peerAddr)
- | TrInboundGovernorError !SomeException
- | TrMaturedConnections !(Set peerAddr) !(Set peerAddr)
- | TrInactive ![(peerAddr, Time)]
- data DebugInboundGovernor peerAddr = DebugInboundGovernor (InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b)
- data RemoteSt
- type RemoteTransition = Transition' (Maybe RemoteSt)
- type RemoteTransitionTrace peerAddr = TransitionTrace' peerAddr (Maybe RemoteSt)
- data AcceptConnectionsPolicyTrace
- data Transition' state = Transition {}
- data TransitionTrace' peerAddr state = TransitionTrace {
- ttPeerAddr :: peerAddr
- ttTransition :: Transition' state
- maturedPeers :: Ord peerAddr => Time -> OrdPSQ peerAddr Time versionData -> (Map peerAddr versionData, OrdPSQ peerAddr Time versionData)
Run Inbound Protocol Governor
data PublicInboundGovernorState peerAddr versionData Source #
Public inbound governor state.
PublicInboundGovernorState | |
|
withInboundGovernor :: forall (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber m a b x. (Alternative (STM m), MonadAsync m, MonadCatch m, MonadEvaluate m, MonadLabelledSTM m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ 'True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> Tracer m (DebugInboundGovernor peerAddr) -> InboundGovernorInfoChannel muxMode initiatorCtx peerAddr versionData ByteString m a b -> Maybe DiffTime -> MuxConnectionManager muxMode socket initiatorCtx (ResponderContext peerAddr) peerAddr versionData versionNumber ByteString m a b -> (Async m Void -> m (PublicInboundGovernorState peerAddr versionData) -> m x) -> m x Source #
Run the server, which consists of the following components:
- inbound governor, it corresponds to p2p-governor on outbound side
- accept loop(s), one per given ip address. We support up to one ipv4 address and up to one ipv6 address, i.e. an ipv6 enabled node will run two accept loops on listening on different addresses with shared inbound governor.
The server can be run in either of two MuxMode
-es:
The first one is used in data diffusion for Node-To-Node protocol, while the other is useful for running a server for the Node-To-Client protocol.
Trace
data InboundGovernorTrace peerAddr Source #
Instances
Show peerAddr => Show (InboundGovernorTrace peerAddr) Source # | |
Defined in Ouroboros.Network.InboundGovernor showsPrec :: Int -> InboundGovernorTrace peerAddr -> ShowS # show :: InboundGovernorTrace peerAddr -> String # showList :: [InboundGovernorTrace peerAddr] -> ShowS # |
data DebugInboundGovernor peerAddr Source #
DebugInboundGovernor (InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b) |
Remote connection state tracked by inbound protocol governor.
This type is used for tracing.
type RemoteTransition = Transition' (Maybe RemoteSt) Source #
Nothing
represents uninitialised state.
type RemoteTransitionTrace peerAddr = TransitionTrace' peerAddr (Maybe RemoteSt) Source #
data AcceptConnectionsPolicyTrace Source #
Trace for the AcceptConnectionsLimit
policy.
ServerTraceAcceptConnectionRateLimiting DiffTime Int | |
ServerTraceAcceptConnectionHardLimit Word32 | |
ServerTraceAcceptConnectionResume Int |
Instances
Re-exports
data Transition' state Source #
Instances
Functor Transition' Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types fmap :: (a -> b) -> Transition' a -> Transition' b # (<$) :: a -> Transition' b -> Transition' a # | |
Show state => Show (Transition' state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types showsPrec :: Int -> Transition' state -> ShowS # show :: Transition' state -> String # showList :: [Transition' state] -> ShowS # | |
Eq state => Eq (Transition' state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types (==) :: Transition' state -> Transition' state -> Bool # (/=) :: Transition' state -> Transition' state -> Bool # |
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 # (<$) :: a -> TransitionTrace' peerAddr b -> TransitionTrace' peerAddr a # | |
(Show peerAddr, Show state) => Show (TransitionTrace' peerAddr state) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Types showsPrec :: Int -> TransitionTrace' peerAddr state -> ShowS # show :: TransitionTrace' peerAddr state -> String # showList :: [TransitionTrace' peerAddr state] -> ShowS # |