ouroboros-consensus-0.21.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Ledger.SupportsPeerSelection

Synopsis

Documentation

class LedgerSupportsPeerSelection blk where Source #

Methods

getPeersLedgerState blk → [(PoolStake, NonEmpty StakePoolRelay)] Source #

Return peers registered in the ledger ordered by descending PoolStake.

For example, for Shelley, the relays that have been registered in the ledger for the respective stake pools will be returned.

Ledgers/blocks that don't support staking can return an empty list.

Note: if the ledger state is old, the registered relays can also be old and may no longer be online.

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

data StakePoolRelay Source #

A relay registered for a stake pool

Constructors

CurrentRelay RelayAccessPoint

One of the current relays

FutureRelay RelayAccessPoint

One of the future relays

Re-exports for convenience

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.14-6b9418fe82cf3ac270565b565c9ca31064fb16ef2588f0c5617a1ab13123b7ca" '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 Source #

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
Storable PortNumber 
Instance details

Defined in Network.Socket.Types

Bounded PortNumber 
Instance details

Defined in Network.Socket.Types

Enum 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

Methods

(==)PortNumberPortNumberBool #

(/=)PortNumberPortNumberBool #

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

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