ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.PeerSelection

Synopsis

Documentation

data PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) Source #

Constructors

PeerSelectionActions 

Fields

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

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.

Instances

Instances details
(Ord peeraddr, Show extraFlags, Show peeraddr, Show extraPeers, Show peerconn, Show extraState) => Show (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn) Source # 
Instance details

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 #

data PeerStateActions peeraddr peerconn (m :: Type -> Type) Source #

Callbacks which are performed to change peer state.

Constructors

PeerStateActions 

Fields

data PeerSelectionPolicy peeraddr (m :: Type -> Type) Source #

Constructors

PeerSelectionPolicy 

Fields

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.

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

data PeerSelectionGovernorArgs extraState extraDebugState extraFlags extraPeers extraAPI extraCounters extraTrace peeraddr peerconn exception (m :: Type -> Type) Source #

Constructors

PeerSelectionGovernorArgs 

Fields

data TracePeerSelection extraDebugState extraFlags extraPeers extraTrace 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

  • [(HotValency, Int)]

    local per-group `(target active, actual active)`, only limited to groups which are below their target.

  • (Set peeraddr)

    selected peers | target active, actual active, peer, reason

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 
TraceChurnAction 

Fields

  • DiffTime

    duration of the churn action

  • ChurnAction

    churn action type

  • Int

    how many peers were removed or added within the duration of the action.

TraceChurnTimeout 

Fields

  • DiffTime

    duration of the churn action

  • ChurnAction

    churn action type

  • Int

    how many peers were removed or added within the duration of the action; note that if the action timeouts the governor will still look to remove or add peers as required.

TraceOnlyBootstrapPeers 
TraceBootstrapPeersFlagChangedWhilstInSensitiveState 
TraceVerifyPeerSnapshot Bool 
TraceOutboundGovernorCriticalFailure SomeException 
TraceDebugState Time (DebugPeerSelectionState extraDebugState extraFlags extraPeers peeraddr) 
ExtraTrace extraTrace 

Instances

Instances details
(Ord peeraddr, Show extraFlags, Show extraPeers, Show peeraddr, Show extraDebugState, Show extraTrace) => Show (TracePeerSelection extraDebugState extraFlags extraPeers extraTrace peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.Governor.Types

Methods

showsPrec :: Int -> TracePeerSelection extraDebugState extraFlags extraPeers extraTrace peeraddr -> ShowS #

show :: TracePeerSelection extraDebugState extraFlags extraPeers extraTrace peeraddr -> String #

showList :: [TracePeerSelection extraDebugState extraFlags extraPeers extraTrace peeraddr] -> ShowS #

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

Instances details
(Show extraState, Show extraFlags, Show extraPeers, Ord peeraddr, Show peeraddr) => Show (DebugPeerSelection extraState extraFlags extraPeers peeraddr) Source # 
Instance details

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 #

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 and PeerSharingDisabled; or
  • UseBootstrapPeers, DontUseLedgerPeers and PeerSharingDisabled, 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.

data DebugPeerSelectionState extraState extraFlags extraPeers peeraddr Source #

Instances

Instances details
(Ord peeraddr, Show extraFlags, Show peeraddr, Show extraPeers, Show extraState) => Show (DebugPeerSelectionState extraState extraFlags extraPeers peeraddr) Source # 
Instance details

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 #

peerSelectionGovernor :: (Alternative (STM m), MonadAsync m, MonadDelay m, MonadLabelledSTM m, MonadMask m, MonadTimer m, Ord peeraddr, Show peerconn, Hashable peeraddr, Exception exception, Eq extraCounters, Semigroup extraPeers, Eq extraFlags) => Tracer m (TracePeerSelection extraDebugState extraFlags extraPeers extraTrace peeraddr) -> Tracer m (DebugPeerSelection extraState extraFlags extraPeers peeraddr) -> Tracer m (PeerSelectionCounters extraCounters) -> PeerSelectionGovernorArgs extraState extraDebugState extraFlags extraPeers extraAPI extraCounters extraTrace peeraddr peerconn exception m -> StdGen -> extraState -> extraPeers -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m -> PeerSelectionPolicy peeraddr m -> PeerSelectionInterfaces extraState extraFlags extraPeers extraCounters peeraddr peerconn m -> m Void Source #

assertPeerSelectionState Source #

Arguments

:: Ord peeraddr 
=> (extraPeers -> Set peeraddr)

This function comes from PublicExtraPeersAPI It is needed to compute the set of all extraPeers and use that information to compute the invariant.

-> (extraPeers -> Bool)

This function comes from PublicExtraPeersAPI It is needed to compute the invariant of the extraPeers data type.

-> 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 #

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 hot, warm, cold counters from PeerSelectionCounters.

Instances

Instances details
Functor (PeerSelectionView extraViews) Source # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 #

peerSelectionStateToCounters Source #

Arguments

:: Ord peeraddr 
=> (extraPeers -> Set peeraddr)

This function comes from PublicExtraPeersAPI It is needed to compute the set of all extraPeers and use that information to compute the counters.

-> (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraCounters) 
-> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn 
-> PeerSelectionCounters extraCounters 

emptyPeerSelectionCounters :: extraCounters -> PeerSelectionCounters extraCounters Source #

emptyPeerSelectionState :: StdGen -> extraState -> extraPeers -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn Source #

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.

data PublicRootPeers extraPeers peeraddr Source #

Public Root Peers consist of either a set of manually configured bootstrap peers.

There's an implicit precedence that will priorise bootstrap peers over the other sets, so if we are adding a bootstrap peer and that peer is already a member of other public root set, it is going to be removed from that set and added to the bootstrap peer set.

Instances

Instances details
(Show peeraddr, Show extraPeers) => Show (PublicRootPeers extraPeers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PublicRootPeers

Methods

showsPrec :: Int -> PublicRootPeers extraPeers peeraddr -> ShowS #

show :: PublicRootPeers extraPeers peeraddr -> String #

showList :: [PublicRootPeers extraPeers peeraddr] -> ShowS #

(Eq peeraddr, Eq extraPeers) => Eq (PublicRootPeers extraPeers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PublicRootPeers

Methods

(==) :: PublicRootPeers extraPeers peeraddr -> PublicRootPeers extraPeers peeraddr -> Bool #

(/=) :: PublicRootPeers extraPeers peeraddr -> PublicRootPeers extraPeers peeraddr -> Bool #

data PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn (m :: Type -> Type) Source #

Constructors

PeerSelectionActions PeerSelectionTargets (STM m PeerSelectionTargets) (STM m (Config extraFlags RelayAccessPoint)) (STM m (Config extraFlags peeraddr)) (m (Map peeraddr PeerSharing)) PeerSharing (peerconn -> PeerSharing) (PublicExtraPeersAPI extraPeers peeraddr) (PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> extraCounters) (LedgerPeersKind -> StdGen -> Int -> m (PublicRootPeers extraPeers peeraddr, DiffTime)) (PeerSharingAmount -> peeraddr -> m (PeerSharingResult peeraddr)) (PeerStateActions peeraddr peerconn m) (LedgerPeersConsensusInterface extraAPI m) (STM m (Maybe LedgerPeerSnapshot)) 

withPeerSelectionActions Source #

Arguments

:: forall extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn resolver m a. (Alternative (STM m), MonadAsync m, MonadDelay m, MonadThrow m, Ord peeraddr, Eq extraFlags) 
=> Tracer m (TraceLocalRootPeers extraFlags peeraddr) 
-> StrictTVar m (Config extraFlags peeraddr) 
-> PeerActionsDNS peeraddr resolver m 
-> ((NumberOfPeers -> LedgerPeersKind -> m (Maybe (Set peeraddr, DiffTime))) -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m)

construct PeerSelectionActions given a function which obtains ledger peers that is supplied by withLedgerPeers.

-> WithLedgerPeersArgs extraAPI m 
-> StdGen 
-> ((Async m Void, Async m Void) -> PeerSelectionActions extraState extraFlags extraPeers extraAPI extraCounters peeraddr peerconn m -> m a)

continuation, receives a handle to the local roots peer provider thread (only if local root peers were non-empty).

-> m a 

requestPeerSharingResult :: (MonadSTM m, MonadMVar m, Ord peeraddr) => STM m (Map peeraddr (PeerSharingController peeraddr m)) -> PeerSharingAmount -> peeraddr -> m (PeerSharingResult peeraddr) Source #

data IP #

A unified IP data for IPv4 and IPv6. To create this, use the data constructors. Or use read "192.0.2.1" :: IP, for example. Also, "192.0.2.1" can be used as literal with OverloadedStrings.

>>> (read "192.0.2.1" :: IP) == IPv4 (read "192.0.2.1" :: IPv4)
True
>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == IPv6 (read "2001:db8:00:00:00:00:00:01" :: IPv6)
True

Constructors

IPv4 

Fields

IPv6 

Fields

Instances

Instances details
Data IP 
Instance details

Defined in Data.IP.Addr

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IP -> c IP #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IP #

toConstr :: IP -> Constr #

dataTypeOf :: IP -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IP) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IP) #

gmapT :: (forall b. Data b => b -> b) -> IP -> IP #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r #

gmapQ :: (forall d. Data d => d -> u) -> IP -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IP -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IP -> m IP #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP #

IsString IP 
Instance details

Defined in Data.IP.Addr

Methods

fromString :: String -> IP #

Enum IP 
Instance details

Defined in Data.IP.Addr

Methods

succ :: IP -> IP #

pred :: IP -> IP #

toEnum :: Int -> IP #

fromEnum :: IP -> Int #

enumFrom :: IP -> [IP] #

enumFromThen :: IP -> IP -> [IP] #

enumFromTo :: IP -> IP -> [IP] #

enumFromThenTo :: IP -> IP -> IP -> [IP] #

Generic IP 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IP 
Instance details

Defined in Data.IP.Addr

type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.15-9cbdeead1ad2dac143f0d52d2bd4e8985efc2da022ee700aca7f7cbbf02b48d0" 'False) (C1 ('MetaCons "IPv4" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv4") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedUnpack) (Rec0 IPv4)) :+: C1 ('MetaCons "IPv6" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv6") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IPv6)))

Methods

from :: IP -> Rep IP x #

to :: Rep IP x -> IP #

Read IP 
Instance details

Defined in Data.IP.Addr

Show IP 
Instance details

Defined in Data.IP.Addr

Methods

showsPrec :: Int -> IP -> ShowS #

show :: IP -> String #

showList :: [IP] -> ShowS #

Eq IP

Equality over IP addresses. Correctly compare IPv4 and IPv4-embedded-in-IPv6 addresses.

>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == (read "2001:db8:00:00:00:00:00:01" :: IP)
True
>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == (read "2001:db8:00:00:00:00:00:05" :: IP)
False
>>> (read "127.0.0.1" :: IP) == (read "127.0.0.1" :: IP)
True
>>> (read "127.0.0.1" :: IP) == (read "10.0.0.1" :: IP)
False
>>> (read "::ffff:127.0.0.1" :: IP) == (read "127.0.0.1" :: IP)
True
>>> (read "::ffff:127.0.0.1" :: IP) == (read "127.0.0.9" :: IP)
False
>>> (read "::ffff:127.0.0.1" :: IP) >= (read "127.0.0.1" :: IP)
True
>>> (read "::ffff:127.0.0.1" :: IP) <= (read "127.0.0.1" :: IP)
True
Instance details

Defined in Data.IP.Addr

Methods

(==) :: IP -> IP -> Bool #

(/=) :: IP -> IP -> Bool #

Ord IP 
Instance details

Defined in Data.IP.Addr

Methods

compare :: IP -> IP -> Ordering #

(<) :: IP -> IP -> Bool #

(<=) :: IP -> IP -> Bool #

(>) :: IP -> IP -> Bool #

(>=) :: IP -> IP -> Bool #

max :: IP -> IP -> IP #

min :: IP -> IP -> IP #

type Rep IP 
Instance details

Defined in Data.IP.Addr

type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.15-9cbdeead1ad2dac143f0d52d2bd4e8985efc2da022ee700aca7f7cbbf02b48d0" 'False) (C1 ('MetaCons "IPv4" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv4") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedUnpack) (Rec0 IPv4)) :+: C1 ('MetaCons "IPv6" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv6") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IPv6)))

data PortNumber #

Port number. Use the Num instance (i.e. use a literal) to create a PortNumber value.

>>> 1 :: PortNumber
1
>>> read "1" :: PortNumber
1
>>> show (12345 :: PortNumber)
"12345"
>>> 50000 < (51000 :: PortNumber)
True
>>> 50000 < (52000 :: PortNumber)
True
>>> 50000 + (10000 :: PortNumber)
60000

Instances

Instances details
Bounded PortNumber 
Instance details

Defined in Network.Socket.Types

Enum PortNumber 
Instance details

Defined in Network.Socket.Types

Storable PortNumber 
Instance details

Defined in Network.Socket.Types

Num PortNumber 
Instance details

Defined in Network.Socket.Types

Read PortNumber 
Instance details

Defined in Network.Socket.Types

Integral PortNumber 
Instance details

Defined in Network.Socket.Types

Real PortNumber 
Instance details

Defined in Network.Socket.Types

Show PortNumber 
Instance details

Defined in Network.Socket.Types

Eq PortNumber 
Instance details

Defined in Network.Socket.Types

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

data RelayAccessPoint #

Instances

Instances details
FromJSON RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToJSON RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

FromCBOR RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToCBOR RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

NFData RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

rnf :: RelayAccessPoint -> () #

Show RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Eq RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

data LedgerRelayAccessPoint #

Instances

Instances details
FromJSON LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToJSON LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

FromCBOR LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToCBOR LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

NFData LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

rnf :: LedgerRelayAccessPoint -> () #

Show LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Eq LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord LedgerRelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

data AfterSlot #

Constructors

Always 
After SlotNo 

Instances

Instances details
Generic AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Associated Types

type Rep AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep AfterSlot = D1 ('MetaData "AfterSlot" "Ouroboros.Network.PeerSelection.LedgerPeers.Type" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "Always" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "After" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo)))
Show AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Eq AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

NoThunks AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep AfterSlot 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep AfterSlot = D1 ('MetaData "AfterSlot" "Ouroboros.Network.PeerSelection.LedgerPeers.Type" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "Always" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "After" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo)))

data UseLedgerPeers #

Instances

Instances details
Generic UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Associated Types

type Rep UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep UseLedgerPeers = D1 ('MetaData "UseLedgerPeers" "Ouroboros.Network.PeerSelection.LedgerPeers.Type" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DontUseLedgerPeers" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UseLedgerPeers" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AfterSlot)))
Show UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Eq UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

NoThunks UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep UseLedgerPeers 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

type Rep UseLedgerPeers = D1 ('MetaData "UseLedgerPeers" "Ouroboros.Network.PeerSelection.LedgerPeers.Type" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DontUseLedgerPeers" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UseLedgerPeers" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AfterSlot)))

data LedgerPeers Source #

Ledger Peer request result

Constructors

LedgerPeers [(PoolStake, NonEmpty RelayAccessPoint)]

Ledger peers

BeforeSlot

No result because the node is still before the configured UseLedgerAfter slot number

newtype NumberOfPeers Source #

Number of peers to pick.

Constructors

NumberOfPeers 

Instances

Instances details
Show NumberOfPeers Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

newtype PoolStake #

Constructors

PoolStake 

Instances

Instances details
NFData PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Methods

rnf :: PoolStake -> () #

Num PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Fractional PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Show PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Eq PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Ord PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

data TraceLedgerPeers Source #

Trace LedgerPeers events.

Constructors

PickedBigLedgerPeer RelayAccessPoint AccPoolStake PoolStake

Trace for a significant ledger peer picked with accumulated and relative stake of its pool.

PickedLedgerPeer RelayAccessPoint AccPoolStake PoolStake

Trace for a ledger peer picked with accumulated and relative stake of its pool.

PickedBigLedgerPeers NumberOfPeers [RelayAccessPoint] 
PickedLedgerPeers NumberOfPeers [RelayAccessPoint]

Trace for the number of peers and we wanted to pick and the list of peers picked.

FetchingNewLedgerState Int Int

Trace for fetching a new list of peers from the ledger. The first Int is the number of ledger peers returned the latter is the number of big ledger peers.

TraceLedgerPeersDomains [RelayAccessPoint] 
DisabledLedgerPeers

Trace for when getting peers from the ledger is disabled, that is DontUseLedgerPeers.

TraceUseLedgerPeers UseLedgerPeers

Trace UseLedgerPeers value

WaitingOnRequest 
RequestForPeers NumberOfPeers 
ReusingLedgerState Int DiffTime 
FallingBackToPublicRootPeers 
NotEnoughBigLedgerPeers NumberOfPeers Int 
NotEnoughLedgerPeers NumberOfPeers Int 
UsingBigLedgerPeerSnapshot 

data WithLedgerPeersArgs extraAPI (m :: Type -> Type) Source #

Argument record for withLedgerPeers

Constructors

WithLedgerPeersArgs 

Fields

withLedgerPeers :: forall peerAddr resolver extraAPI m a. (MonadAsync m, MonadThrow m, MonadMonotonicTime m, Ord peerAddr) => PeerActionsDNS peerAddr resolver m -> WithLedgerPeersArgs extraAPI m -> ((NumberOfPeers -> LedgerPeersKind -> m (Maybe (Set peerAddr, DiffTime))) -> Async m Void -> m a) -> m a Source #

For a LedgerPeers worker thread and submit request and receive responses.

data PeerMetrics (m :: Type -> Type) p Source #

Mutable peer metrics state accessible via STM.

newtype PeerMetricsConfiguration Source #

Constructors

PeerMetricsConfiguration 

Fields

  • maxEntriesToTrack :: Int

    The maximum numbers of slots we will store data for. On some chains sometimes this corresponds to 1h worth of metrics *sighs*.

    this number MUST correspond to number of headers / blocks which are produced in one hour.

Instances

Instances details
NFData PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

Generic PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

Associated Types

type Rep PeerMetricsConfiguration 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

type Rep PeerMetricsConfiguration = D1 ('MetaData "PeerMetricsConfiguration" "Ouroboros.Network.PeerSelection.PeerMetric" "ouroboros-network-0.23.0.0-inplace" 'True) (C1 ('MetaCons "PeerMetricsConfiguration" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxEntriesToTrack") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))
Show PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

NoThunks PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

type Rep PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

type Rep PeerMetricsConfiguration = D1 ('MetaData "PeerMetricsConfiguration" "Ouroboros.Network.PeerSelection.PeerMetric" "ouroboros-network-0.23.0.0-inplace" 'True) (C1 ('MetaCons "PeerMetricsConfiguration" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxEntriesToTrack") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

data ReportPeerMetrics (m :: Type -> Type) peerAddr #

Constructors

ReportPeerMetrics 

nullMetric :: forall (m :: Type -> Type) p. MonadSTM m => ReportPeerMetrics m p Source #

reportMetric :: forall (m :: Type -> Type) p. (MonadSTM m, Ord p) => PeerMetricsConfiguration -> PeerMetrics m p -> ReportPeerMetrics m (ConnectionId p) Source #

data PeerAdvertise #

Instances

Instances details
FromJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

ToJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Generic PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Associated Types

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))
Show PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Eq PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Ord PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))

data PeerSharing #

Instances

Instances details
Monoid PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

Semigroup PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

Generic PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

Associated Types

type Rep PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

type Rep PeerSharing = D1 ('MetaData "PeerSharing" "Ouroboros.Network.PeerSelection.PeerSharing" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "PeerSharingDisabled" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerSharingEnabled" 'PrefixI 'False) (U1 :: Type -> Type))
Read PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

Show PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

Eq PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

type Rep PeerSharing 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerSharing

type Rep PeerSharing = D1 ('MetaData "PeerSharing" "Ouroboros.Network.PeerSelection.PeerSharing" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "PeerSharingDisabled" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerSharingEnabled" 'PrefixI 'False) (U1 :: Type -> Type))

newtype PeerSharingAmount #

Constructors

PeerSharingAmount 

Fields

Instances

Instances details
Enum PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Generic PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Associated Types

type Rep PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

type Rep PeerSharingAmount = D1 ('MetaData "PeerSharingAmount" "Ouroboros.Network.Protocol.PeerSharing.Type" "ouroboros-network-0.23.0.0-inplace-protocols" 'True) (C1 ('MetaCons "PeerSharingAmount" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAmount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))
Num PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Integral PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Real PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Show PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Eq PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Ord PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Serialise PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

type Rep PeerSharingAmount 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

type Rep PeerSharingAmount = D1 ('MetaData "PeerSharingAmount" "Ouroboros.Network.Protocol.PeerSharing.Type" "ouroboros-network-0.23.0.0-inplace-protocols" 'True) (C1 ('MetaCons "PeerSharingAmount" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAmount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))

data PeerSharingResult peerAddress #

Constructors

PeerSharingResult [peerAddress] 
PeerSharingNotRegisteredYet 

Instances

Instances details
Show peerAddress => Show (PeerSharingResult peerAddress) 
Instance details

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) 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Methods

(==) :: PeerSharingResult peerAddress -> PeerSharingResult peerAddress -> Bool #

(/=) :: PeerSharingResult peerAddress -> PeerSharingResult peerAddress -> Bool #

newtype Resource (m :: Type -> Type) a Source #

Evolving resource; We use it to reinitialise the DNS library if the `etcresolv.conf` file was modified.

Note: constantResource and retryResource are written using a simplified approach inspired by _"The Different Aspects of Monads and Mixins"_, by Bruno C. d S. Oliveira, see https://www.youtube.com/watch?v=pfwP4hXM5hA.

Constructors

Resource 

Fields

Instances

Instances details
Functor m => Functor (Resource m) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

Methods

fmap :: (a -> b) -> Resource m a -> Resource m b #

(<$) :: a -> Resource m b -> Resource m a #

resolveLedgerPeers :: forall m peerAddr resolver. (Ord peerAddr, MonadThrow m, MonadAsync m) => DNSSemaphore m -> ResolvConf -> DNSActions peerAddr resolver m -> LedgerPeersKind -> [RelayAccessPoint] -> StdGen -> m (Map Domain (Set peerAddr)) Source #

Provides DNS resolution functionality.

Concurrently resolve DNS names, respecting the maxDNSConcurrency limit.

data DNSActions peerAddr resolver (m :: Type -> Type) Source #

Dictionary of DNS actions vocabulary

Constructors

DNSActions 

Fields

data DNSSemaphore (m :: Type -> Type) Source #

A semaphore used to limit concurrency of dns names resolution.

data PeerActionsDNS peeraddr resolver (m :: Type -> Type) Source #

Record of some parameters that are commonly used together

TODO: rename as PeerDNSActions; can we bundle paToPeerAddr with DNSActions?

Constructors

PeerActionsDNS 

Fields

ioDNSActions :: Tracer IO DNSTrace -> DNSLookupType -> (IP -> PortNumber -> peerAddr) -> DNSActions peerAddr Resolver IO Source #

IO DNSActions which resolve domain names with Resolver.

The IPv4 and IPv6 addresses the node will be using should determine the LookupReqs so that we can avoid lookups for address types that wont be used.

It guarantees that returned TTLs are strictly greater than 0.

type DNSLookupResult peerAddr = Either [DNSError] [(peerAddr, TTL)] Source #

Wraps lookup result for client code

data DNSTrace Source #

Provides DNS lookup trace information

Constructors

DNSLookupResult

DNS lookup result

Fields

DNSLookupError DNSPeersKind (Maybe DNSLookupType) Domain DNSError

DNS lookup error

SRVLookupResult DNSPeersKind Domain [(Domain, Word16, Word16, Word16, TTL)] 
SRVLookupError

SRV resolution errors, all dns errors are traced with DNSLookupError

Fields

Instances

Instances details
Show DNSTrace Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

retryResource :: forall (m :: Type -> Type) e a. MonadDelay m => Tracer m e -> NonEmpty DiffTime -> Resource m (Either e a) -> Resource m a Source #

A Resource which will exhibit the given Resource but retry it with a given delay until a success. On first success it will reset the delays.

constantResource :: forall (m :: Type -> Type) a. Applicative m => a -> Resource m a Source #

dispatchLookupWithTTL :: MonadAsync m => DNSLookupType -> (resolver -> resolvConf -> Domain -> TYPE -> m (Maybe (Either DNSError DNSMessage))) -> Tracer m DNSTrace -> (IP -> PortNumber -> peerAddr) -> DNSPeersKind -> RelayAccessPoint -> resolvConf -> resolver -> StdGen -> m (DNSLookupResult peerAddr) Source #

data DNSPeersKind Source #

Bundled with DNS lookup trace for observability

newLedgerAndPublicRootDNSSemaphore :: MonadSTM m => m (DNSSemaphore m) Source #

Create a DNSSemaphore for root and ledger peers.

newDNSLocalRootSemaphore :: forall (m :: Type -> Type). MonadSTM m => STM m (DNSSemaphore m) Source #

Create a DNSSemaphore for local root peers.

withDNSSemaphore :: (MonadSTM m, MonadThrow m) => DNSSemaphore m -> m a -> m a Source #

Run a computation by attempting to acquire the semaphore first. On termination or failure free the semaphore

localRootPeersProvider Source #

Arguments

:: forall m extraFlags peerAddr resolver. (Alternative (STM m), MonadAsync m, MonadDelay m, MonadThrow m, Ord peerAddr, Eq extraFlags) 
=> Tracer m (TraceLocalRootPeers extraFlags peerAddr) 
-> PeerActionsDNS peerAddr resolver m 
-> ResolvConf 
-> StdGen 
-> STM m [(HotValency, WarmValency, Map RelayAccessPoint (LocalRootConfig extraFlags))]

input

-> StrictTVar m [(HotValency, WarmValency, Map peerAddr (LocalRootConfig extraFlags))]

output TVar

-> m Void 

Resolve RelayAddress-es of local root peers using dns if needed. Local roots are provided wrapped in a StrictTVar, which value might change (re-read form a config file). The resolved dns names are available through the output StrictTVar.

data TraceLocalRootPeers extraFlags peerAddr Source #

Constructors

TraceLocalRootDomains (Config extraFlags RelayAccessPoint)

Int is the configured valency for the local producer groups

TraceLocalRootWaiting RelayAccessPoint DiffTime 
TraceLocalRootGroups (Config extraFlags peerAddr)

This traces the results of the local root peer provider

TraceLocalRootDNSMap (Map RelayAccessPoint [peerAddr])

This traces the results of the domain name resolution

TraceLocalRootReconfigured 

Fields

TraceLocalRootFailure RelayAccessPoint DNSorIOError 
TraceLocalRootError Domain SomeException 

Instances

Instances details
(Show extraFlags, Show peerAddr) => Show (TraceLocalRootPeers extraFlags peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers

Methods

showsPrec :: Int -> TraceLocalRootPeers extraFlags peerAddr -> ShowS #

show :: TraceLocalRootPeers extraFlags peerAddr -> String #

showList :: [TraceLocalRootPeers extraFlags peerAddr] -> ShowS #

publicRootPeersProvider :: forall peerAddr resolver a m. (MonadThrow m, MonadAsync m, Ord peerAddr) => Tracer m TracePublicRootPeers -> (IP -> PortNumber -> peerAddr) -> DNSSemaphore m -> ResolvConf -> STM m (Map RelayAccessPoint PeerAdvertise) -> DNSActions peerAddr resolver m -> StdGen -> ((Int -> m (Map peerAddr PeerAdvertise, DiffTime)) -> m a) -> m a Source #

fulfills a request from requestPublicRootPeers

data KnownPeerInfo Source #

Constructors

KnownPeerInfo 

Fields

  • knownPeerFailCount :: !Int

    The current number of consecutive connection attempt failures. This is reset as soon as there is a successful connection.

    It is used to implement the exponential backoff strategy and may also be used by policies to select peers to forget.

  • knownPeerTepid :: !Bool

    Indicates if the peer was hot but then got demoted.

    It is set on the hot to warm promotion and reset on cold to warm, thus it can be present for warm or cold peers. It's purpose is to provide information to demotion policies.

    It is also used as useful information for the Peer Selection Governor when deciding which peers to share when Peer Sharing.

  • knownPeerSharing :: !(StrictMaybe PeerSharing)

    Indicates current remote Peer Willingness information.

    If a connection with this address hasn't been established we won't have any information about this particular flag

    It is used by the Peer Sharing logic to decide if we should share/ask about/to this peer's address to others.

  • knownPeerAdvertise :: !(StrictMaybe PeerAdvertise)

    Indicates current local Peer Willingness information.

    If this address didn't come from a local configuration then this value is set to DoAdvertise by default.

    It is used by the Peer Sharing logic to decide if we should share about this peer's address to others.

  • knownSuccessfulConnection :: !Bool

    Indicates if the node managed to connect to the peer at some point in time.

    This differs from the tepid flag in a way that this flag will be set/enabled if we established a successful connection with this peer. It won't be unset after this.

data LocalRootPeers extraFlags peeraddr Source #

Instances

Instances details
(Show extraFlags, Show peeraddr, Ord peeraddr) => Show (LocalRootPeers extraFlags peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.State.LocalRootPeers

Methods

showsPrec :: Int -> LocalRootPeers extraFlags peeraddr -> ShowS #

show :: LocalRootPeers extraFlags peeraddr -> String #

showList :: [LocalRootPeers extraFlags peeraddr] -> ShowS #

(Eq peeraddr, Eq extraFlags) => Eq (LocalRootPeers extraFlags peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.State.LocalRootPeers

Methods

(==) :: LocalRootPeers extraFlags peeraddr -> LocalRootPeers extraFlags peeraddr -> Bool #

(/=) :: LocalRootPeers extraFlags peeraddr -> LocalRootPeers extraFlags peeraddr -> Bool #

data LocalRootConfig extraFlags Source #

Instances

Instances details
Show extraFlags => Show (LocalRootConfig extraFlags) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.State.LocalRootPeers

Methods

showsPrec :: Int -> LocalRootConfig extraFlags -> ShowS #

show :: LocalRootConfig extraFlags -> String #

showList :: [LocalRootConfig extraFlags] -> ShowS #

Eq extraFlags => Eq (LocalRootConfig extraFlags) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.State.LocalRootPeers

Methods

(==) :: LocalRootConfig extraFlags -> LocalRootConfig extraFlags -> Bool #

(/=) :: LocalRootConfig extraFlags -> LocalRootConfig extraFlags -> Bool #