Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.PeerSelection.Governor.Types
Synopsis
- data PeerSelectionPolicy peeraddr (m :: Type -> Type) = PeerSelectionPolicy {
- policyPickKnownPeersForPeerShare :: PickPolicy peeraddr (STM m)
- policyPickColdPeersToPromote :: PickPolicy peeraddr (STM m)
- policyPickWarmPeersToPromote :: PickPolicy peeraddr (STM m)
- policyPickHotPeersToDemote :: PickPolicy peeraddr (STM m)
- policyPickWarmPeersToDemote :: PickPolicy peeraddr (STM m)
- policyPickColdPeersToForget :: PickPolicy peeraddr (STM m)
- policyPickInboundPeers :: PickPolicy peeraddr (STM m)
- policyFindPublicRootTimeout :: !DiffTime
- policyMaxInProgressPeerShareReqs :: !Int
- policyPeerShareRetryTime :: !DiffTime
- policyPeerShareBatchWaitTime :: !DiffTime
- policyPeerShareOverallTimeout :: !DiffTime
- policyPeerShareActivationDelay :: !DiffTime
- policyErrorDelay :: !DiffTime
- data PeerSelectionTargets = PeerSelectionTargets {}
- nullPeerSelectionTargets :: PeerSelectionTargets
- sanePeerSelectionTargets :: PeerSelectionTargets -> Bool
- type PickPolicy peeraddr (m :: Type -> Type) = (peeraddr -> PeerSource) -> (peeraddr -> Int) -> (peeraddr -> Bool) -> Set peeraddr -> Int -> m (Set peeraddr)
- pickPeers :: (Ord peeraddr, Functor m, HasCallStack) => (peeraddr -> extraPeers -> Bool) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PickPolicy peeraddr m -> Set peeraddr -> Int -> m (Set peeraddr)
- pickUnknownPeers :: (Ord peeraddr, Functor m, HasCallStack) => (peeraddr -> extraPeers -> Bool) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PickPolicy peeraddr m -> Set peeraddr -> Int -> m (Set peeraddr)
- data PeerStateActions peeraddr peerconn (m :: Type -> Type) = PeerStateActions {
- monitorPeerConnection :: peerconn -> STM m (PeerStatus, Maybe RepromoteDelay)
- establishPeerConnection :: IsBigLedgerPeer -> DiffusionMode -> peeraddr -> m peerconn
- activatePeerConnection :: IsBigLedgerPeer -> peerconn -> m ()
- deactivatePeerConnection :: peerconn -> m ()
- closePeerConnection :: peerconn -> m ()
- data PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) = PeerSelectionActions {
- peerSelectionTargets :: PeerSelectionTargets
- readPeerSelectionTargets :: STM m PeerSelectionTargets
- readLocalRootPeersFromFile :: STM m (Config extraFlags RelayAccessPoint)
- readLocalRootPeers :: STM m (Config extraFlags peeraddr)
- readInboundPeers :: m (Map peeraddr PeerSharing)
- peerSharing :: PeerSharing
- peerConnToPeerSharing :: peerconn -> PeerSharing
- extraPeersAPI :: PublicExtraPeersAPI extraPeers peeraddr
- extraStateToExtraCounters :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraCounters
- requestPublicRootPeers :: LedgerPeersKind -> Int -> m (PublicRootPeers extraPeers peeraddr, DiffTime)
- requestPeerShare :: PeerSharingAmount -> peeraddr -> m (PeerSharingResult peeraddr)
- peerStateActions :: PeerStateActions peeraddr peerconn m
- getLedgerStateCtx :: LedgerPeersConsensusInterface extraAPI m
- readLedgerPeerSnapshot :: STM m (Maybe LedgerPeerSnapshot)
- data PeerSelectionInterfaces extraState extraFlags extraPeers extraCounters peeraddr peerconn (m :: Type -> Type) = PeerSelectionInterfaces {
- countersVar :: StrictTVar m (PeerSelectionCounters extraCounters)
- publicStateVar :: StrictTVar m (PublicPeerSelectionState peeraddr)
- debugStateVar :: StrictTVar m (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn)
- readUseLedgerPeers :: STM m UseLedgerPeers
- type MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) = PeerSelectionPolicy peeraddr m -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Guarded (STM m) (TimedDecision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn)
- data ExtraGuardedDecisions extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) = ExtraGuardedDecisions {
- preBlocking :: MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m
- postBlocking :: MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m
- postNonBlocking :: MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m
- customTargetsAction :: Maybe (MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m)
- customLocalRootsAction :: Maybe (MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m)
- enableProgressMakingActions :: extraState -> Bool
- ledgerPeerSnapshotExtraStateChange :: extraState -> extraState
- data PeerSelectionGovernorArgs extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn exception (m :: Type -> Type) = PeerSelectionGovernorArgs {
- abortGovernor :: Time -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Maybe exception
- updateWithState :: PeerSelectionInterfaces extraState extraFlags extraPeers extraCounters peeraddr peerconn m -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m -> PeerSelectionSetsWithSizes extraCounters peeraddr -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> STM m ()
- extraDecisions :: ExtraGuardedDecisions extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m
- data PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn = PeerSelectionState {
- targets :: !PeerSelectionTargets
- localRootPeers :: !(LocalRootPeers extraFlags peeraddr)
- publicRootPeers :: !(PublicRootPeers extraPeers peeraddr)
- knownPeers :: !(KnownPeers peeraddr)
- establishedPeers :: !(EstablishedPeers peeraddr peerconn)
- activePeers :: !(Set peeraddr)
- publicRootBackoffs :: !Int
- publicRootRetryTime :: !Time
- inProgressPublicRootsReq :: !Bool
- bigLedgerPeerBackoffs :: !Int
- bigLedgerPeerRetryTime :: !Time
- inProgressBigLedgerPeersReq :: !Bool
- inProgressPeerShareReqs :: !Int
- inProgressPromoteCold :: !(Set peeraddr)
- inProgressPromoteWarm :: !(Set peeraddr)
- inProgressDemoteWarm :: !(Set peeraddr)
- inProgressDemoteHot :: !(Set peeraddr)
- inProgressDemoteToCold :: !(Set peeraddr)
- stdGen :: !StdGen
- inboundPeersRetryTime :: !Time
- ledgerPeerSnapshot :: Maybe LedgerPeerSnapshot
- extraState :: extraState
- emptyPeerSelectionState :: StdGen -> extraState -> extraPeers -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn
- data AssociationMode
- data DebugPeerSelectionState extraState extraFlags extraPeers peeraddr = DebugPeerSelectionState {
- dpssTargets :: !PeerSelectionTargets
- dpssLocalRootPeers :: !(LocalRootPeers extraFlags peeraddr)
- dpssPublicRootPeers :: !(PublicRootPeers extraPeers peeraddr)
- dpssKnownPeers :: !(KnownPeers peeraddr)
- dpssEstablishedPeers :: !(Set peeraddr)
- dpssActivePeers :: !(Set peeraddr)
- dpssPublicRootBackoffs :: !Int
- dpssPublicRootRetryTime :: !Time
- dpssInProgressPublicRootsReq :: !Bool
- dpssBigLedgerPeerBackoffs :: !Int
- dpssBigLedgerPeerRetryTime :: !Time
- dpssInProgressBigLedgerPeersReq :: !Bool
- dpssInProgressPeerShareReqs :: !Int
- dpssInProgressPromoteCold :: !(Set peeraddr)
- dpssInProgressPromoteWarm :: !(Set peeraddr)
- dpssInProgressDemoteWarm :: !(Set peeraddr)
- dpssInProgressDemoteHot :: !(Set peeraddr)
- dpssInProgressDemoteToCold :: !(Set peeraddr)
- dpssUpstreamyness :: !(Map peeraddr Int)
- dpssFetchynessBlocks :: !(Map peeraddr Int)
- dpssAssociationMode :: !AssociationMode
- dpssExtraState :: !extraState
- makeDebugPeerSelectionState :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Map peeraddr Int -> Map peeraddr Int -> extraDebugState -> AssociationMode -> DebugPeerSelectionState extraDebugState extraFlags extraPeers peeraddr
- assertPeerSelectionState :: Ord peeraddr => (extraPeers -> Set peeraddr) -> (extraPeers -> Bool) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> a -> a
- establishedPeersStatus :: Ord peeraddr => PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Map peeraddr PeerStatus
- newtype PublicPeerSelectionState peeraddr = PublicPeerSelectionState {
- availableToShare :: Set peeraddr
- makePublicPeerSelectionStateVar :: (MonadSTM m, Ord peeraddr) => m (StrictTVar m (PublicPeerSelectionState peeraddr))
- toPublicState :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PublicPeerSelectionState peeraddr
- data Guarded (m :: Type -> Type) a where
- data Decision (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn = Decision {
- decisionTrace :: [TracePeerSelection extraDebugState extraFlags extraPeers peeraddr]
- decisionState :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn
- decisionJobs :: [Job () m (Completion m extraState extraDebugState extraFlags extraPeers peeraddr peerconn)]
- type TimedDecision (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn = Time -> Decision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn
- type MkGuardedDecision extraState extraDebugState extraFlags extraPeers peeraddr peerconn (m :: Type -> Type) = PeerSelectionPolicy peeraddr m -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Guarded (STM m) (TimedDecision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn)
- newtype Completion (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn = Completion (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Time -> Decision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn)
- data PeerSelectionView extraViews a where
- PeerSelectionView {
- viewRootPeers :: a
- viewKnownPeers :: a
- viewAvailableToConnectPeers :: a
- viewColdPeersPromotions :: a
- viewEstablishedPeers :: a
- viewWarmPeersDemotions :: a
- viewWarmPeersPromotions :: a
- viewActivePeers :: a
- viewActivePeersDemotions :: a
- viewKnownBigLedgerPeers :: a
- viewAvailableToConnectBigLedgerPeers :: a
- viewColdBigLedgerPeersPromotions :: a
- viewEstablishedBigLedgerPeers :: a
- viewWarmBigLedgerPeersDemotions :: a
- viewWarmBigLedgerPeersPromotions :: a
- viewActiveBigLedgerPeers :: a
- viewActiveBigLedgerPeersDemotions :: a
- viewKnownLocalRootPeers :: a
- viewAvailableToConnectLocalRootPeers :: a
- viewColdLocalRootPeersPromotions :: a
- viewEstablishedLocalRootPeers :: a
- viewWarmLocalRootPeersPromotions :: a
- viewActiveLocalRootPeers :: a
- viewActiveLocalRootPeersDemotions :: a
- viewKnownNonRootPeers :: a
- viewColdNonRootPeersPromotions :: a
- viewEstablishedNonRootPeers :: a
- viewWarmNonRootPeersDemotions :: a
- viewWarmNonRootPeersPromotions :: a
- viewActiveNonRootPeers :: a
- viewActiveNonRootPeersDemotions :: a
- viewExtraViews :: extraViews
- pattern PeerSelectionCounters :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> extraCounters -> PeerSelectionCounters extraCounters
- pattern PeerSelectionCountersHWC :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> PeerSelectionCounters extraCounters
- PeerSelectionView {
- type PeerSelectionCounters extraCounters = PeerSelectionView extraCounters Int
- type PeerSelectionSetsWithSizes extraViews peeraddr = PeerSelectionView extraViews (Set peeraddr, Int)
- emptyPeerSelectionCounters :: extraCounters -> PeerSelectionCounters extraCounters
- peerSelectionStateToCounters :: Ord peeraddr => (extraPeers -> Set peeraddr) -> (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraCounters) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PeerSelectionCounters extraCounters
- peerSelectionStateToView :: Ord peeraddr => (extraPeers -> Set peeraddr) -> (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraViews) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PeerSelectionSetsWithSizes extraViews peeraddr
- data PeerSharingResult peerAddress
- = PeerSharingResult [peerAddress]
- | PeerSharingNotRegisteredYet
- data TracePeerSelection extraDebugState extraFlags extraPeers peeraddr
- = TraceLocalRootPeersChanged (LocalRootPeers extraFlags peeraddr) (LocalRootPeers extraFlags peeraddr)
- | TraceTargetsChanged PeerSelectionTargets PeerSelectionTargets
- | TracePublicRootsRequest Int Int
- | TracePublicRootsResults (PublicRootPeers extraPeers peeraddr) Int DiffTime
- | TracePublicRootsFailure SomeException Int DiffTime
- | TraceForgetColdPeers Int Int (Set peeraddr)
- | TraceBigLedgerPeersRequest Int Int
- | TraceBigLedgerPeersResults (Set peeraddr) Int DiffTime
- | TraceBigLedgerPeersFailure SomeException Int DiffTime
- | TraceForgetBigLedgerPeers Int Int (Set peeraddr)
- | TracePeerShareRequests Int Int PeerSharingAmount (Set peeraddr) (Set peeraddr)
- | TracePeerShareResults [(peeraddr, Either SomeException (PeerSharingResult peeraddr))]
- | TracePeerShareResultsFiltered [peeraddr]
- | TracePickInboundPeers Int Int (Map peeraddr PeerSharing) (Set peeraddr)
- | TracePromoteColdPeers Int Int (Set peeraddr)
- | TracePromoteColdLocalPeers [(WarmValency, Int)] (Set peeraddr)
- | TracePromoteColdFailed Int Int peeraddr DiffTime SomeException
- | TracePromoteColdDone Int Int peeraddr
- | TracePromoteColdBigLedgerPeers Int Int (Set peeraddr)
- | TracePromoteColdBigLedgerPeerFailed Int Int peeraddr DiffTime SomeException
- | TracePromoteColdBigLedgerPeerDone Int Int peeraddr
- | TracePromoteWarmPeers Int Int (Set peeraddr)
- | TracePromoteWarmLocalPeers [(HotValency, Int)] (Set peeraddr)
- | TracePromoteWarmFailed Int Int peeraddr SomeException
- | TracePromoteWarmDone Int Int peeraddr
- | TracePromoteWarmAborted Int Int peeraddr
- | TracePromoteWarmBigLedgerPeers Int Int (Set peeraddr)
- | TracePromoteWarmBigLedgerPeerFailed Int Int peeraddr SomeException
- | TracePromoteWarmBigLedgerPeerDone Int Int peeraddr
- | TracePromoteWarmBigLedgerPeerAborted Int Int peeraddr
- | TraceDemoteWarmPeers Int Int (Set peeraddr)
- | TraceDemoteWarmFailed Int Int peeraddr SomeException
- | TraceDemoteWarmDone Int Int peeraddr
- | TraceDemoteWarmBigLedgerPeers Int Int (Set peeraddr)
- | TraceDemoteWarmBigLedgerPeerFailed Int Int peeraddr SomeException
- | TraceDemoteWarmBigLedgerPeerDone Int Int peeraddr
- | TraceDemoteHotPeers Int Int (Set peeraddr)
- | TraceDemoteLocalHotPeers [(HotValency, Int)] (Set peeraddr)
- | TraceDemoteHotFailed Int Int peeraddr SomeException
- | TraceDemoteHotDone Int Int peeraddr
- | TraceDemoteHotBigLedgerPeers Int Int (Set peeraddr)
- | TraceDemoteHotBigLedgerPeerFailed Int Int peeraddr SomeException
- | TraceDemoteHotBigLedgerPeerDone Int Int peeraddr
- | TraceDemoteAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay))
- | TraceDemoteLocalAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay))
- | TraceDemoteBigLedgerPeersAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay))
- | TraceGovernorWakeup
- | TraceChurnWait DiffTime
- | TraceChurnMode ChurnMode
- | TraceChurnAction DiffTime ChurnAction Int
- | TraceChurnTimeout DiffTime ChurnAction Int
- | TraceLedgerStateJudgementChanged LedgerStateJudgement
- | TraceOnlyBootstrapPeers
- | TraceBootstrapPeersFlagChangedWhilstInSensitiveState
- | TraceUseBootstrapPeersChanged UseBootstrapPeers
- | TraceVerifyPeerSnapshot Bool
- | TraceOutboundGovernorCriticalFailure SomeException
- | TraceDebugState Time (DebugPeerSelectionState extraDebugState extraFlags extraPeers peeraddr)
- data ChurnAction
- = DecreasedActivePeers
- | IncreasedActivePeers
- | DecreasedActiveBigLedgerPeers
- | IncreasedActiveBigLedgerPeers
- | DecreasedEstablishedPeers
- | IncreasedEstablishedPeers
- | IncreasedEstablishedBigLedgerPeers
- | DecreasedEstablishedBigLedgerPeers
- | DecreasedKnownPeers
- | IncreasedKnownPeers
- | DecreasedKnownBigLedgerPeers
- | IncreasedKnownBigLedgerPeers
- data DebugPeerSelection extraState extraFlags extraPeers peeraddr where
- TraceGovernorState :: forall extraState extraFlags extraPeers peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> DebugPeerSelection extraState extraFlags extraPeers peeraddr
- data BootstrapPeersCriticalTimeoutError = BootstrapPeersCriticalTimeoutError
P2P governor policies
data PeerSelectionPolicy peeraddr (m :: Type -> Type) Source #
Constructors
data PeerSelectionTargets Source #
Adjustable targets for the peer selection mechanism.
These are used by the peer selection governor as targets. They are used by the peer churn governor loop as knobs to adjust, to influence the peer selection governor.
The known, established and active peer targets are targets both from below and from above: the governor will attempt to grow or shrink the sets to hit these targets.
Unlike the other targets, the root peer target is "one sided", it is only a target from below. The governor does not try to shrink the root set to hit it, it simply stops looking for more.
There is also an implicit target that enough local root peers are selected as active. This comes from the configuration for local roots, and is not an independently adjustable target.
Constructors
PeerSelectionTargets | |
Fields
|
Instances
Show PeerSelectionTargets Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> PeerSelectionTargets -> ShowS # show :: PeerSelectionTargets -> String # showList :: [PeerSelectionTargets] -> ShowS # | |
Eq PeerSelectionTargets Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods (==) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # (/=) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # |
type PickPolicy peeraddr (m :: Type -> Type) = (peeraddr -> PeerSource) -> (peeraddr -> Int) -> (peeraddr -> Bool) -> Set peeraddr -> Int -> m (Set peeraddr) Source #
A peer pick policy is an action that picks a subset of elements from a map of peers.
The pre-condition is that the map of available choices will be non-empty, and the requested number to pick will be strictly positive.
The post-condition is that the picked set is non-empty but must not be bigger than the requested number.
Peer selection API is using `STM m` monad, internally it is using m
.
Cardano Node specific functions
Arguments
:: (Ord peeraddr, Functor m, HasCallStack) | |
=> (peeraddr -> extraPeers -> Bool) | This function comes from It is needed to compute membership of the extraPeers data type. |
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn | |
-> PickPolicy peeraddr m | |
-> Set peeraddr | |
-> Int | |
-> m (Set peeraddr) |
Pick some known peers.
Arguments
:: (Ord peeraddr, Functor m, HasCallStack) | |
=> (peeraddr -> extraPeers -> Bool) | This function comes from It is needed to compute membership of the extraPeers data type. |
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn | |
-> PickPolicy peeraddr m | |
-> Set peeraddr | |
-> Int | |
-> m (Set peeraddr) |
Pick some unknown peers.
P2P governor low level API
data PeerStateActions peeraddr peerconn (m :: Type -> Type) Source #
Callbacks which are performed to change peer state.
Constructors
PeerStateActions | |
Fields
|
data PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) Source #
Constructors
PeerSelectionActions | |
Fields
|
data PeerSelectionInterfaces extraState extraFlags extraPeers extraCounters peeraddr peerconn (m :: Type -> Type) Source #
Interfaces required by the peer selection governor, which do not need to
be shared with actions and thus are not part of PeerSelectionActions
.
Constructors
PeerSelectionInterfaces | |
Fields
|
type MonitoringAction extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) = PeerSelectionPolicy peeraddr m -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Guarded (STM m) (TimedDecision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn) Source #
data ExtraGuardedDecisions extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) Source #
Constructors
ExtraGuardedDecisions | |
Fields
|
data PeerSelectionGovernorArgs extraState extraDebugState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn exception (m :: Type -> Type) Source #
Constructors
PeerSelectionGovernorArgs | |
Fields
|
P2P governor internals
data PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn Source #
The internal state used by the peerSelectionGovernor
.
The local and public root sets are disjoint, and their union is the overall root set.
Documentation of individual fields describes some of the invariants these
structures should maintain. For the entire picture, see
assertPeerSelectionState
.
Constructors
PeerSelectionState | |
Fields
|
Instances
(Ord peeraddr, Show extraFlags, Show peeraddr, Show extraPeers, Show peerconn, Show extraState) => Show (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> ShowS # show :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> String # showList :: [PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn] -> ShowS # |
emptyPeerSelectionState :: StdGen -> extraState -> extraPeers -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn Source #
data AssociationMode Source #
A node is classified as LocalRootsOnly
if it is a hidden relay or
a BP, e.g. if it is configured such that it can only have a chance to be
connected to local roots. This is true if the node is configured in one of
two ways:
DontUseBootstrapPeers
,DontUseLedgerPeers
andPeerSharingDisabled
; orUseBootstrapPeers
,DontUseLedgerPeers
andPeerSharingDisabled
, but it's not using any bootstrap peers (i.e. it is synced).
Note that in the second case a node might transition between LocalRootsOnly
and Unrestricted
modes, depending on LedgerStateJudgement
.
See readAssociationMode
.
Constructors
LocalRootsOnly | |
Unrestricted |
Instances
Show AssociationMode Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> AssociationMode -> ShowS # show :: AssociationMode -> String # showList :: [AssociationMode] -> ShowS # |
data DebugPeerSelectionState extraState extraFlags extraPeers peeraddr Source #
Constructors
DebugPeerSelectionState | |
Fields
|
Instances
(Ord peeraddr, Show extraFlags, Show peeraddr, Show extraPeers, Show extraState) => Show (DebugPeerSelectionState extraState extraFlags extraPeers peeraddr) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> DebugPeerSelectionState extraState extraFlags extraPeers peeraddr -> ShowS # show :: DebugPeerSelectionState extraState extraFlags extraPeers peeraddr -> String # showList :: [DebugPeerSelectionState extraState extraFlags extraPeers peeraddr] -> ShowS # |
makeDebugPeerSelectionState :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Map peeraddr Int -> Map peeraddr Int -> extraDebugState -> AssociationMode -> DebugPeerSelectionState extraDebugState extraFlags extraPeers peeraddr Source #
assertPeerSelectionState Source #
Arguments
:: Ord peeraddr | |
=> (extraPeers -> Set peeraddr) | This function comes from |
-> (extraPeers -> Bool) | This function comes from |
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn | |
-> a | |
-> a |
establishedPeersStatus :: Ord peeraddr => PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Map peeraddr PeerStatus Source #
A view of the status of each established peer, for testing and debugging.
newtype PublicPeerSelectionState peeraddr Source #
Public PeerSelectionState
that can be accessed by Peer Sharing
mechanisms without any problem.
This data type should not expose too much information and keep only essential data needed for computing the peer sharing request result
Constructors
PublicPeerSelectionState | |
Fields
|
makePublicPeerSelectionStateVar :: (MonadSTM m, Ord peeraddr) => m (StrictTVar m (PublicPeerSelectionState peeraddr)) Source #
toPublicState :: PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PublicPeerSelectionState peeraddr Source #
Convert a PeerSelectionState
into a public record accessible by the
Peer Sharing mechanisms so we can know about which peers are available and
possibly other needed context.
data Guarded (m :: Type -> Type) a where Source #
The governor is using Guarded m (Decision m peeraddr peerconn)
where m
is an STM
monad, to drive its progress.
Bundled Patterns
pattern GuardedSkip :: Maybe Time -> Guarded m a |
Let us note that the combined value which is computed by |
pattern Guarded :: Maybe Time -> m a -> Guarded m a |
|
Instances
Alternative m => Monoid (Guarded m a) Source # | |
Alternative m => Semigroup (Guarded m a) Source # |
Guarded x y <> a = Guarded x' y' a <> Guarded x y = Guarded x' y' In the algebraic sense, Ref. absorbing element |
data Decision (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn Source #
Constructors
Decision | |
Fields
|
type TimedDecision (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn = Time -> Decision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn Source #
Decision which has access to the current time, rather than the time when the governor's loop blocked to make a decision.
type MkGuardedDecision extraState extraDebugState extraFlags extraPeers peeraddr peerconn (m :: Type -> Type) = PeerSelectionPolicy peeraddr m -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Guarded (STM m) (TimedDecision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn) Source #
Type alias for function types which are used to create governor decisions. Almost all decisions are following this pattern.
newtype Completion (m :: Type -> Type) extraState extraDebugState extraFlags extraPeers peeraddr peerconn Source #
Constructors
Completion (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> Time -> Decision m extraState extraDebugState extraFlags extraPeers peeraddr peerconn) |
data PeerSelectionView extraViews a Source #
Peer selection view.
This is a functor which is used to hold computation of various peer sets and
their sizes. See peerSelectionStateToView
, peerSelectionStateToCounters
.
Constructors
PeerSelectionView | |
Fields
|
Bundled Patterns
pattern PeerSelectionCounters :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> extraCounters -> PeerSelectionCounters extraCounters | |
pattern PeerSelectionCountersHWC :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> PeerSelectionCounters extraCounters | A Pattern synonym which computes |
Instances
Functor (PeerSelectionView extraViews) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods fmap :: (a -> b) -> PeerSelectionView extraViews a -> PeerSelectionView extraViews b # (<$) :: a -> PeerSelectionView extraViews b -> PeerSelectionView extraViews a # | |
(Show a, Show extraViews) => Show (PeerSelectionView extraViews a) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> PeerSelectionView extraViews a -> ShowS # show :: PeerSelectionView extraViews a -> String # showList :: [PeerSelectionView extraViews a] -> ShowS # | |
(Eq a, Eq extraViews) => Eq (PeerSelectionView extraViews a) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods (==) :: PeerSelectionView extraViews a -> PeerSelectionView extraViews a -> Bool # (/=) :: PeerSelectionView extraViews a -> PeerSelectionView extraViews a -> Bool # |
type PeerSelectionCounters extraCounters = PeerSelectionView extraCounters Int Source #
type PeerSelectionSetsWithSizes extraViews peeraddr = PeerSelectionView extraViews (Set peeraddr, Int) Source #
emptyPeerSelectionCounters :: extraCounters -> PeerSelectionCounters extraCounters Source #
Cardano Node specific functions
peerSelectionStateToCounters Source #
Arguments
:: Ord peeraddr | |
=> (extraPeers -> Set peeraddr) | This function comes from |
-> (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraCounters) | |
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn | |
-> PeerSelectionCounters extraCounters |
peerSelectionStateToView :: Ord peeraddr => (extraPeers -> Set peeraddr) -> (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraViews) -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> PeerSelectionSetsWithSizes extraViews peeraddr Source #
Compute peer selection sets & their sizes.
This function is used internally by the outbound-governor and to compute
PeerSelectionCounters
which are used by churn or are traced (e.g. as EKG
metrics). For this reason one has to be very careful when changing the
function, as it will affect the outbound governor behaviour.
Peer Sharing Auxiliary data type
data PeerSharingResult peerAddress #
PeerSharing Result type.
We need a constructor for the case when the Governor wins the race versus the Mux (when initialising the peer sharing miniprotocol). This leads the Governor to lookup a peer that hasn't been registered yet.
Constructors
PeerSharingResult [peerAddress] | |
PeerSharingNotRegisteredYet |
Instances
Show peerAddress => Show (PeerSharingResult peerAddress) | |
Defined in Ouroboros.Network.Protocol.PeerSharing.Type Methods showsPrec :: Int -> PeerSharingResult peerAddress -> ShowS # show :: PeerSharingResult peerAddress -> String # showList :: [PeerSharingResult peerAddress] -> ShowS # | |
Eq peerAddress => Eq (PeerSharingResult peerAddress) | |
Defined in Ouroboros.Network.Protocol.PeerSharing.Type Methods (==) :: PeerSharingResult peerAddress -> PeerSharingResult peerAddress -> Bool # (/=) :: PeerSharingResult peerAddress -> PeerSharingResult peerAddress -> Bool # |
Traces
data TracePeerSelection extraDebugState extraFlags extraPeers peeraddr Source #
Constructors
TraceLocalRootPeersChanged (LocalRootPeers extraFlags peeraddr) (LocalRootPeers extraFlags peeraddr) | |
TraceTargetsChanged PeerSelectionTargets PeerSelectionTargets | Peer selection targets changed: old targets, new targets. |
TracePublicRootsRequest Int Int | |
TracePublicRootsResults (PublicRootPeers extraPeers peeraddr) Int DiffTime | |
TracePublicRootsFailure SomeException Int DiffTime | |
TraceForgetColdPeers Int Int (Set peeraddr) | target known peers, actual known peers, selected peers |
TraceBigLedgerPeersRequest Int Int | |
TraceBigLedgerPeersResults (Set peeraddr) Int DiffTime | |
TraceBigLedgerPeersFailure SomeException Int DiffTime | |
TraceForgetBigLedgerPeers Int Int (Set peeraddr) | target known big ledger peers, actual known big ledger peers, selected peers |
TracePeerShareRequests Int Int PeerSharingAmount (Set peeraddr) (Set peeraddr) | target known peers, actual known peers, number of peers to request, peers available for peer sharing, peers selected for peer sharing |
TracePeerShareResults [(peeraddr, Either SomeException (PeerSharingResult peeraddr))] | |
TracePeerShareResultsFiltered [peeraddr] | |
TracePickInboundPeers Int Int (Map peeraddr PeerSharing) (Set peeraddr) | target known peers, actual known peers, selected inbound peers, available peers |
TracePromoteColdPeers Int Int (Set peeraddr) | target established, actual established, selected peers |
TracePromoteColdLocalPeers [(WarmValency, Int)] (Set peeraddr) | target local established, actual local established, selected peers |
TracePromoteColdFailed Int Int peeraddr DiffTime SomeException | |
TracePromoteColdDone Int Int peeraddr | target established, actual established, peer |
TracePromoteColdBigLedgerPeers Int Int (Set peeraddr) | target established big ledger peers, actual established big ledger peers, selected peers |
TracePromoteColdBigLedgerPeerFailed Int Int peeraddr DiffTime SomeException | target established big ledger peers, actual established big ledger peers, peer, delay until next promotion, reason |
TracePromoteColdBigLedgerPeerDone Int Int peeraddr | target established big ledger peers, actual established big ledger peers, peer |
TracePromoteWarmPeers Int Int (Set peeraddr) | target active, actual active, selected peers |
TracePromoteWarmLocalPeers | Promote local peers to warm |
Fields
| |
TracePromoteWarmFailed Int Int peeraddr SomeException | |
TracePromoteWarmDone Int Int peeraddr | target active, actual active, peer |
TracePromoteWarmAborted Int Int peeraddr | aborted promotion of a warm peer; likely it was asynchronously demoted in the meantime. target active, actual active, peer |
TracePromoteWarmBigLedgerPeers Int Int (Set peeraddr) | target active big ledger peers, actual active big ledger peers, selected peers |
TracePromoteWarmBigLedgerPeerFailed Int Int peeraddr SomeException | target active big ledger peers, actual active big ledger peers, peer, reason |
TracePromoteWarmBigLedgerPeerDone Int Int peeraddr | target active big ledger peers, actual active big ledger peers, peer |
TracePromoteWarmBigLedgerPeerAborted Int Int peeraddr | aborted promotion of a warm big ledger peer; likely it was asynchronously demoted in the meantime. target active, actual active, peer |
TraceDemoteWarmPeers Int Int (Set peeraddr) | target established, actual established, selected peers |
TraceDemoteWarmFailed Int Int peeraddr SomeException | target established, actual established, peer, reason |
TraceDemoteWarmDone Int Int peeraddr | target established, actual established, peer |
TraceDemoteWarmBigLedgerPeers Int Int (Set peeraddr) | target established big ledger peers, actual established big ledger peers, selected peers |
TraceDemoteWarmBigLedgerPeerFailed Int Int peeraddr SomeException | target established big ledger peers, actual established big ledger peers, peer, reason |
TraceDemoteWarmBigLedgerPeerDone Int Int peeraddr | target established big ledger peers, actual established big ledger peers, peer |
TraceDemoteHotPeers Int Int (Set peeraddr) | target active, actual active, selected peers |
TraceDemoteLocalHotPeers [(HotValency, Int)] (Set peeraddr) | local per-group (target active, actual active), selected peers |
TraceDemoteHotFailed Int Int peeraddr SomeException | target active, actual active, peer, reason |
TraceDemoteHotDone Int Int peeraddr | target active, actual active, peer |
TraceDemoteHotBigLedgerPeers Int Int (Set peeraddr) | target active big ledger peers, actual active big ledger peers, selected peers |
TraceDemoteHotBigLedgerPeerFailed Int Int peeraddr SomeException | target active big ledger peers, actual active big ledger peers, peer, reason |
TraceDemoteHotBigLedgerPeerDone Int Int peeraddr | target active big ledger peers, actual active big ledger peers, peer |
TraceDemoteAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay)) | |
TraceDemoteLocalAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay)) | |
TraceDemoteBigLedgerPeersAsynchronous (Map peeraddr (PeerStatus, Maybe RepromoteDelay)) | |
TraceGovernorWakeup | |
TraceChurnWait DiffTime | |
TraceChurnMode ChurnMode | |
TraceChurnAction | |
Fields
| |
TraceChurnTimeout | |
Fields
| |
TraceLedgerStateJudgementChanged LedgerStateJudgement | |
TraceOnlyBootstrapPeers | |
TraceBootstrapPeersFlagChangedWhilstInSensitiveState | |
TraceUseBootstrapPeersChanged UseBootstrapPeers | |
TraceVerifyPeerSnapshot Bool | |
TraceOutboundGovernorCriticalFailure SomeException | |
TraceDebugState Time (DebugPeerSelectionState extraDebugState extraFlags extraPeers peeraddr) |
Instances
(Ord peeraddr, Show extraFlags, Show extraPeers, Show peeraddr, Show extraDebugState) => Show (TracePeerSelection extraDebugState extraFlags extraPeers peeraddr) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> TracePeerSelection extraDebugState extraFlags extraPeers peeraddr -> ShowS # show :: TracePeerSelection extraDebugState extraFlags extraPeers peeraddr -> String # showList :: [TracePeerSelection extraDebugState extraFlags extraPeers peeraddr] -> ShowS # |
data ChurnAction Source #
Constructors
Instances
Show ChurnAction Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> ChurnAction -> ShowS # show :: ChurnAction -> String # showList :: [ChurnAction] -> ShowS # | |
Eq ChurnAction Source # | |
data DebugPeerSelection extraState extraFlags extraPeers peeraddr where Source #
Constructors
TraceGovernorState :: forall extraState extraFlags extraPeers peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> DebugPeerSelection extraState extraFlags extraPeers peeraddr |
Instances
(Show extraState, Show extraFlags, Show extraPeers, Ord peeraddr, Show peeraddr) => Show (DebugPeerSelection extraState extraFlags extraPeers peeraddr) Source # | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> DebugPeerSelection extraState extraFlags extraPeers peeraddr -> ShowS # show :: DebugPeerSelection extraState extraFlags extraPeers peeraddr -> String # showList :: [DebugPeerSelection extraState extraFlags extraPeers peeraddr] -> ShowS # |
Error types
data BootstrapPeersCriticalTimeoutError Source #
Constructors
BootstrapPeersCriticalTimeoutError |