ouroboros-network-0.1.0.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellNone
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
Eq DomainAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord DomainAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Show DomainAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

FromJSON DomainAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

parseJSON ∷ Value → Parser DomainAccessPoint

parseJSONList ∷ Value → Parser [DomainAccessPoint]

ToJSON DomainAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

toJSONDomainAccessPoint → Value

toEncodingDomainAccessPoint → Encoding

toJSONList ∷ [DomainAccessPoint] → Value

toEncodingList ∷ [DomainAccessPoint] → Encoding

data IP #

Constructors

IPv4 

Fields

IPv6 

Fields

Instances

Instances details
Enum IP 
Instance details

Defined in Data.IP.Addr

Methods

succIPIP Source #

predIPIP Source #

toEnumIntIP Source #

fromEnumIPInt Source #

enumFromIP → [IP] Source #

enumFromThenIPIP → [IP] Source #

enumFromToIPIP → [IP] Source #

enumFromThenToIPIPIP → [IP] Source #

Eq IP 
Instance details

Defined in Data.IP.Addr

Methods

(==)IPIPBool Source #

(/=)IPIPBool Source #

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

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

toConstrIPConstr Source #

dataTypeOfIPDataType Source #

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

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

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

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

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

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

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

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

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

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

Ord IP 
Instance details

Defined in Data.IP.Addr

Methods

compareIPIPOrdering Source #

(<)IPIPBool Source #

(<=)IPIPBool Source #

(>)IPIPBool Source #

(>=)IPIPBool Source #

maxIPIPIP Source #

minIPIPIP Source #

Read IP 
Instance details

Defined in Data.IP.Addr

Show IP 
Instance details

Defined in Data.IP.Addr

Methods

showsPrecIntIPShowS Source #

showIPString Source #

showList ∷ [IP] → ShowS Source #

IsString IP 
Instance details

Defined in Data.IP.Addr

Methods

fromStringStringIP Source #

Generic IP 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPTypeType Source #

Methods

fromIPRep IP x Source #

toRep IP x → IP Source #

type Rep IP 
Instance details

Defined in Data.IP.Addr

type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.12-05e1c06e95ad98d75f6a9a33f0ea4ecd286d5acebf9a6bc4c84febea70fead77" '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 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
Eq RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Ord RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Show RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

NFData RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

rnfRelayAccessPoint → () Source #

FromJSON RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

parseJSON ∷ Value → Parser RelayAccessPoint

parseJSONList ∷ Value → Parser [RelayAccessPoint]

ToJSON RelayAccessPoint Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint

Methods

toJSONRelayAccessPoint → Value

toEncodingRelayAccessPoint → Encoding

toJSONList ∷ [RelayAccessPoint] → Value

toEncodingList ∷ [RelayAccessPoint] → Encoding

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
Eq PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

Fractional PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

Num PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

Ord PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

Show PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

NFData PoolStake Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.LedgerPeers

Methods

rnfPoolStake → () Source #

data TraceLedgerPeers Source #

Trace LedgerPeers events.

Constructors

PickedPeer RelayAccessPoint AccPoolStake PoolStake

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

PickedPeers NumberOfPeers [RelayAccessPoint]

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

FetchingNewLedgerState Int

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

DisabledLedgerPeers

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

TraceUseLedgerAfter UseLedgerAfter

Trace UseLedgerAfter value

WaitingOnRequest 
RequestForPeers NumberOfPeers 
ReusingLedgerState Int DiffTime 
FallingBackToBootstrapPeers 

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).

withLedgerPeers ∷ ∀ peerAddr m a. (MonadAsync m, MonadTime m, Ord peerAddr) ⇒ StdGen → (IPPortNumber → peerAddr) → Tracer m TraceLedgerPeers → STM m UseLedgerAfterLedgerPeersConsensusInterface m → ([DomainAccessPoint] → m (Map DomainAccessPoint (Set peerAddr))) → ((NumberOfPeers → m (Maybe (Set peerAddr, DiffTime))) → Async m Void → m a) → m a Source #

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

data UseLedgerAfter Source #

Only use the ledger after the given slot number.

data PortNumber #

Instances

Instances details
Bounded PortNumber 
Instance details

Defined in Network.Socket.Types

Enum PortNumber 
Instance details

Defined in Network.Socket.Types

Eq PortNumber 
Instance details

Defined in Network.Socket.Types

Integral PortNumber 
Instance details

Defined in Network.Socket.Types

Num PortNumber 
Instance details

Defined in Network.Socket.Types

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

Read 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

Storable PortNumber 
Instance details

Defined in Network.Socket.Types