Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ouroboros.Network.InboundGovernor.State
Contents
Synopsis
- newtype InboundGovernorObservableState = InboundGovernorObservableState {}
- newObservableStateVar ∷ MonadLabelledSTM m ⇒ StdGen → m (StrictTVar m InboundGovernorObservableState)
- newObservableStateVarIO ∷ IO (StrictTVar IO InboundGovernorObservableState)
- newObservableStateVarFromSeed ∷ MonadLabelledSTM m ⇒ Int → m (StrictTVar m InboundGovernorObservableState)
- data InboundGovernorState muxMode peerAddr m a b = InboundGovernorState {
- igsConnections ∷ !(Map (ConnectionId peerAddr) (ConnectionState muxMode peerAddr m a b))
- igsObservableVar ∷ !(StrictTVar m InboundGovernorObservableState)
- igsCountersCache ∷ !(Cache InboundGovernorCounters)
- data ConnectionState muxMode peerAddr m a b = ConnectionState {
- csMux ∷ !(Mux muxMode m)
- csDataFlow ∷ !DataFlow
- csMiniProtocolMap ∷ !(Map MiniProtocolNum (MiniProtocolData muxMode m a b))
- csCompletionMap ∷ !(Map MiniProtocolNum (STM m (Either SomeException b)))
- csRemoteState ∷ !(RemoteState m)
- data InboundGovernorCounters = InboundGovernorCounters {}
- inboundGovernorCounters ∷ InboundGovernorState muxMode peerAddr m a b → InboundGovernorCounters
- unregisterConnection ∷ Ord peerAddr ⇒ ConnectionId peerAddr → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b
- updateMiniProtocol ∷ Ord peerAddr ⇒ ConnectionId peerAddr → MiniProtocolNum → STM m (Either SomeException b) → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b
- data RemoteState m where
- RemoteWarm
- RemoteHot
- RemoteIdle !(STM m ())
- RemoteCold
- pattern RemoteEstablished ∷ RemoteState m
- updateRemoteState ∷ Ord peerAddr ⇒ ConnectionId peerAddr → RemoteState m → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b
- mapRemoteState ∷ Ord peerAddr ⇒ ConnectionId peerAddr → (RemoteState m → RemoteState m) → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b
- data MiniProtocolData muxMode m a b = MiniProtocolData {
- mpdMiniProtocol ∷ !(MiniProtocol muxMode ByteString m a b)
- mpdMiniProtocolTemp ∷ !ProtocolTemperature
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
advanced prune strategies (see. PruneStrategy
).
Constructors
InboundGovernorObservableState | |
newObservableStateVar ∷ MonadLabelledSTM m ⇒ StdGen → m (StrictTVar m InboundGovernorObservableState) Source #
Create new observable state StrictTVar
.
newObservableStateVarIO ∷ IO (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
inboundGovernorCounters ∷ InboundGovernorState muxMode peerAddr m a b → InboundGovernorCounters Source #
unregisterConnection ∷ Ord peerAddr ⇒ ConnectionId peerAddr → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #
Remove connection from InboundGovernorState
.
updateMiniProtocol ∷ Ord 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 |
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 |
Bundled Patterns
pattern RemoteEstablished ∷ RemoteState m |
updateRemoteState ∷ Ord peerAddr ⇒ ConnectionId peerAddr → RemoteState m → InboundGovernorState muxMode peerAddr m a b → InboundGovernorState muxMode peerAddr m a b Source #
Set csRemoteState
for a given connection.
mapRemoteState ∷ Ord 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
|