ouroboros-network-0.16.1.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.PeerSelection.LedgerPeers

Synopsis

Documentation

data DomainAccessPoint Source #

A product of a Domain and PortNumber. After resolving the domain we will use the PortNumber to form SockAddr.

Instances

Instances details
FromJSON DomainAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToJSON DomainAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Show DomainAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Eq DomainAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord DomainAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

data IP Source #

A unified IP data for IP and IP. 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 ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → IP → c IP #

gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c IP #

toConstrIPConstr #

dataTypeOfIPDataType #

dataCast1Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c IP) #

dataCast2Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c IP) #

gmapT ∷ (∀ b. Data b ⇒ b → b) → IPIP #

gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → IP → r #

gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → IP → r #

gmapQ ∷ (∀ d. Data d ⇒ d → u) → IP → [u] #

gmapQiInt → (∀ d. Data d ⇒ d → u) → IP → u #

gmapMMonad m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP #

gmapMpMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP #

gmapMoMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP #

IsString IP 
Instance details

Defined in Data.IP.Addr

Methods

fromStringStringIP #

Enum IP 
Instance details

Defined in Data.IP.Addr

Methods

succIPIP #

predIPIP #

toEnumIntIP #

fromEnumIPInt #

enumFromIP → [IP] #

enumFromThenIPIP → [IP] #

enumFromToIPIP → [IP] #

enumFromThenToIPIPIP → [IP] #

Generic IP 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPTypeType #

Methods

fromIPRep IP x #

toRep IP x → IP #

Read IP 
Instance details

Defined in Data.IP.Addr

Show IP 
Instance details

Defined in Data.IP.Addr

Methods

showsPrecIntIPShowS #

showIPString #

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

(==)IPIPBool #

(/=)IPIPBool #

Ord IP 
Instance details

Defined in Data.IP.Addr

Methods

compareIPIPOrdering #

(<)IPIPBool #

(<=)IPIPBool #

(>)IPIPBool #

(>=)IPIPBool #

maxIPIPIP #

minIPIPIP #

type Rep IP 
Instance details

Defined in Data.IP.Addr

type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.12-c8dcf98c77bcf5b3a2b5fcc77fceb05c73045c1aa77bbb37bdac9daecbe194e6" '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 LedgerPeers Source #

Ledger Peer request result

Constructors

LedgerPeers 

Fields

BeforeSlot

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

getLedgerPeersMonadSTM m ⇒ LedgerPeersConsensusInterface m → AfterSlotSTM m LedgerPeers Source #

Internal API to deal with UseLedgerAfter configuration option

Receiving the LedgerPeersConsensusInterface we are able to compute a function that given a SlotNo will give us LedgerPeers according to the following invariants:

  • BeforeSlot is returned iff the latest slot is before the slotNo;
  • 'LedgerPeers lsj peers' is returned iff the latest slot is after the slotNo.

data RelayAccessPoint Source #

A relay can have either an IP address and a port number or a domain with a port number

Bundled Patterns

pattern RelayDomainAccessPointDomainAccessPointRelayAccessPoint

RelayDomainAccessPoint a bidirectional pattern which links RelayAccessDomain and DomainAccessPoint.

Instances

Instances details
FromJSON RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

ToJSON RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Show RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

NFData RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

rnfRelayAccessPoint → () #

Eq RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord RelayAccessPoint 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

newtype PoolStake Source #

The relative stake of a stakepool in relation to the total amount staked. A value in the [0, 1] range.

Constructors

PoolStake 

Fields

Instances

Instances details
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

Methods

showsPrecIntPoolStakeShowS #

showPoolStakeString #

showList ∷ [PoolStake] → ShowS #

NFData PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Methods

rnfPoolStake → () #

Eq PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Methods

(==)PoolStakePoolStakeBool #

(/=)PoolStakePoolStakeBool #

Ord PoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

newtype AccPoolStake Source #

The accumulated relative stake of a stake pool, like PoolStake but it also includes the relative stake of all preceding pools. A value in the range [0, 1].

Constructors

AccPoolStake 

Instances

Instances details
Num AccPoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Fractional AccPoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Show AccPoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Eq AccPoolStake 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Ord AccPoolStake 
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 [DomainAccessPoint] 
TraceLedgerPeersResult Domain [(IP, TTL)] 
TraceLedgerPeersFailure Domain DNSError 
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 

newtype NumberOfPeers Source #

Constructors

NumberOfPeers 

Instances

Instances details
Show NumberOfPeers Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common

data LedgerPeersKind Source #

Which ledger peers to pick.

Instances

Instances details
Show LedgerPeersKind 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type

Ledger Peers specific functions

accPoolStake ∷ [(PoolStake, NonEmpty RelayAccessPoint)] → Map AccPoolStake (PoolStake, NonEmpty RelayAccessPoint) Source #

Convert a list of pools with stake to a Map keyed on the accumulated stake. Consensus provides a list of pairs of relative stake and corresponding relays for all usable registered pools. By creating a Map keyed on the AccPoolStake that is the sum of the pool's relative stake and the stake of all preceding pools we can support weighted random selection in O(log n) time by taking advantage of Map.lookupGE (returns the smallest key greater or equal to the provided value).

bigLedgerPeerQuotaAccPoolStake Source #

The total accumulated stake of big ledger peers.

DNS based provider for ledger root peers

data WithLedgerPeersArgs m Source #

Argument record for withLedgerPeers

Constructors

WithLedgerPeersArgs 

Fields

withLedgerPeers ∷ ∀ peerAddr resolver exception m a. (MonadAsync m, MonadThrow m, MonadMonotonicTime m, Exception exception, Ord peerAddr) ⇒ PeerActionsDNS peerAddr resolver exception m → WithLedgerPeersArgs m → ((NumberOfPeersLedgerPeersKind → m (Maybe (Set peerAddr, DiffTime))) → Async m Void → m a) → m a Source #

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

Internal only exported for testing purposes

resolveLedgerPeers ∷ ∀ m peerAddr resolver exception. (Ord peerAddr, MonadThrow m, MonadAsync m, Exception exception) ⇒ Tracer m TraceLedgerPeers → (IPPortNumber → peerAddr) → DNSSemaphore m → ResolvConfDNSActions resolver exception m → [DomainAccessPoint] → m (Map DomainAccessPoint (Set peerAddr)) Source #

Provides DNS resolution functionality.

Concurrently resolve DNS names, respecting the maxDNSConcurrency limit.