Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data PublicInboundGovernorState peerAddr versionData = PublicInboundGovernorState {
- inboundDuplexPeers :: !(Map peerAddr versionData)
- remoteStateMap :: Map (ConnectionId peerAddr) RemoteSt
- mkPublicInboundGovernorState :: forall (muxMode :: MuxMode) initatorCtx versionData peerAddr (m :: Type -> Type) a b. InboundGovernorState muxMode initatorCtx peerAddr versionData m a b -> PublicInboundGovernorState peerAddr versionData
- data InboundGovernorState (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b = InboundGovernorState {
- igsConnections :: !(Map (ConnectionId peerAddr) (ConnectionState muxMode initiatorCtx peerAddr versionData m a b))
- igsMatureDuplexPeers :: !(Map peerAddr versionData)
- igsFreshDuplexPeers :: !(OrdPSQ peerAddr Time versionData)
- igsCountersCache :: !(Cache InboundGovernorCounters)
- data ConnectionState (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b = ConnectionState {
- csMux :: !(Mux muxMode m)
- csDataFlow :: !DataFlow
- csVersionData :: !versionData
- csMiniProtocolMap :: !(Map MiniProtocolNum (MiniProtocolData muxMode initiatorCtx peerAddr m a b))
- csCompletionMap :: !(Map MiniProtocolNum (STM m (Either SomeException b)))
- csRemoteState :: !(RemoteState m)
- data InboundGovernorCounters = InboundGovernorCounters {
- coldPeersRemote :: !Int
- idlePeersRemote :: !Int
- warmPeersRemote :: !Int
- hotPeersRemote :: !Int
- inboundGovernorCounters :: forall (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b. InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorCounters
- unregisterConnection :: forall peerAddr (muxMode :: MuxMode) initiatorCtx versionData (m :: Type -> Type) a b. Ord peerAddr => ConnectionId peerAddr -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b
- updateMiniProtocol :: forall peerAddr (m :: Type -> Type) b (muxMode :: MuxMode) initiatorCtx versionData a. Ord peerAddr => ConnectionId peerAddr -> MiniProtocolNum -> STM m (Either SomeException b) -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b
- data RemoteState (m :: Type -> Type) where
- RemoteWarm
- RemoteHot
- RemoteIdle !(STM m ())
- RemoteCold
- pattern RemoteEstablished :: RemoteState m
- data RemoteSt
- mkRemoteSt :: forall (m :: Type -> Type). RemoteState m -> RemoteSt
- updateRemoteState :: forall peerAddr (m :: Type -> Type) (muxMode :: MuxMode) initiatorCtx versionData a b. Ord peerAddr => ConnectionId peerAddr -> RemoteState m -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b
- mapRemoteState :: forall peerAddr (m :: Type -> Type) (muxMode :: MuxMode) initiatorCtx versionData a b. Ord peerAddr => ConnectionId peerAddr -> (RemoteState m -> RemoteState m) -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b
- data MiniProtocolData (muxMode :: MuxMode) initiatorCtx peerAddr (m :: Type -> Type) a b = MiniProtocolData {
- mpdMiniProtocol :: !(MiniProtocol muxMode initiatorCtx (ResponderContext peerAddr) ByteString m a b)
- mpdResponderContext :: !(ResponderContext peerAddr)
- mpdMiniProtocolTemp :: !ProtocolTemperature
Documentation
data PublicInboundGovernorState peerAddr versionData Source #
Public inbound governor state.
PublicInboundGovernorState | |
|
Internals
mkPublicInboundGovernorState :: forall (muxMode :: MuxMode) initatorCtx versionData peerAddr (m :: Type -> Type) a b. InboundGovernorState muxMode initatorCtx peerAddr versionData m a b -> PublicInboundGovernorState peerAddr versionData Source #
Smart constructor for PublicInboundGovernorState
.
NOTE: we assume that all inbound connections share the same address. This
is true in P2P mode since all outbound connections (which also can end up in
the InboundGovernorState
) bind the server address. This allows us to use
mapKeysMonotonic
.
data InboundGovernorState (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) 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.
InboundGovernorState | |
|
data ConnectionState (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b Source #
Per connection state tracked by inbound protocol governor.
ConnectionState | |
|
data InboundGovernorCounters Source #
Counters for tracing and analysis purposes
InboundGovernorCounters | |
|
Instances
inboundGovernorCounters :: forall (muxMode :: MuxMode) initiatorCtx peerAddr versionData (m :: Type -> Type) a b. InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorCounters Source #
unregisterConnection :: forall peerAddr (muxMode :: MuxMode) initiatorCtx versionData (m :: Type -> Type) a b. Ord peerAddr => ConnectionId peerAddr -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b Source #
Remove connection from InboundGovernorState
.
updateMiniProtocol :: forall peerAddr (m :: Type -> Type) b (muxMode :: MuxMode) initiatorCtx versionData a. Ord peerAddr => ConnectionId peerAddr -> MiniProtocolNum -> STM m (Either SomeException b) -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData 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 :: Type -> Type) 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.
RemoteWarm | After |
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
|
RemoteCold | The For a For a |
pattern RemoteEstablished :: RemoteState m |
Remote connection state tracked by inbound protocol governor.
This type is used for tracing.
mkRemoteSt :: forall (m :: Type -> Type). RemoteState m -> RemoteSt Source #
updateRemoteState :: forall peerAddr (m :: Type -> Type) (muxMode :: MuxMode) initiatorCtx versionData a b. Ord peerAddr => ConnectionId peerAddr -> RemoteState m -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b Source #
Set csRemoteState
for a given connection.
mapRemoteState :: forall peerAddr (m :: Type -> Type) (muxMode :: MuxMode) initiatorCtx versionData a b. Ord peerAddr => ConnectionId peerAddr -> (RemoteState m -> RemoteState m) -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b -> InboundGovernorState muxMode initiatorCtx peerAddr versionData m a b Source #
data MiniProtocolData (muxMode :: MuxMode) initiatorCtx peerAddr (m :: Type -> Type) a b Source #
MiniProtocolData | |
|