Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data DomainAccessPoint = DomainAccessPoint {}
- data IP
- data LedgerPeers
- getLedgerPeers ∷ MonadSTM m ⇒ LedgerPeersConsensusInterface m → AfterSlot → STM m LedgerPeers
- data RelayAccessPoint where
- newtype PoolStake = PoolStake {}
- newtype AccPoolStake = AccPoolStake {}
- data TraceLedgerPeers
- = PickedBigLedgerPeer RelayAccessPoint AccPoolStake PoolStake
- | PickedLedgerPeer RelayAccessPoint AccPoolStake PoolStake
- | PickedBigLedgerPeers NumberOfPeers [RelayAccessPoint]
- | PickedLedgerPeers NumberOfPeers [RelayAccessPoint]
- | FetchingNewLedgerState Int Int
- | TraceLedgerPeersDomains [DomainAccessPoint]
- | TraceLedgerPeersResult Domain [(IP, TTL)]
- | TraceLedgerPeersFailure Domain DNSError
- | DisabledLedgerPeers
- | TraceUseLedgerPeers UseLedgerPeers
- | WaitingOnRequest
- | RequestForPeers NumberOfPeers
- | ReusingLedgerState Int DiffTime
- | FallingBackToPublicRootPeers
- | NotEnoughBigLedgerPeers NumberOfPeers Int
- | NotEnoughLedgerPeers NumberOfPeers Int
- newtype NumberOfPeers = NumberOfPeers {}
- data LedgerPeersKind
- accPoolStake ∷ [(PoolStake, NonEmpty RelayAccessPoint)] → Map AccPoolStake (PoolStake, NonEmpty RelayAccessPoint)
- accBigPoolStake ∷ [(PoolStake, NonEmpty RelayAccessPoint)] → Map AccPoolStake (PoolStake, NonEmpty RelayAccessPoint)
- bigLedgerPeerQuota ∷ AccPoolStake
- data WithLedgerPeersArgs m = WithLedgerPeersArgs {}
- withLedgerPeers ∷ ∀ peerAddr resolver exception m a. (MonadAsync m, MonadThrow m, MonadMonotonicTime m, Exception exception, Ord peerAddr) ⇒ PeerActionsDNS peerAddr resolver exception m → WithLedgerPeersArgs m → ((NumberOfPeers → LedgerPeersKind → m (Maybe (Set peerAddr, DiffTime))) → Async m Void → m a) → m a
- module Ouroboros.Network.PeerSelection.LedgerPeers.Type
- module Ouroboros.Network.PeerSelection.LedgerPeers.Common
- resolveLedgerPeers ∷ ∀ m peerAddr resolver exception. (Ord peerAddr, MonadThrow m, MonadAsync m, Exception exception) ⇒ Tracer m TraceLedgerPeers → (IP → PortNumber → peerAddr) → DNSSemaphore m → ResolvConf → DNSActions resolver exception m → [DomainAccessPoint] → m (Map DomainAccessPoint (Set peerAddr))
Documentation
data DomainAccessPoint Source #
A product of a Domain
and PortNumber
. After resolving the
domain we will use the PortNumber
to form SockAddr
.
Instances
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
Instances
Data IP | |
Defined in Data.IP.Addr 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 # dataTypeOf ∷ IP → DataType # dataCast1 ∷ Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c IP) # dataCast2 ∷ Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c IP) # gmapT ∷ (∀ b. Data b ⇒ b → b) → IP → IP # 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] # gmapQi ∷ Int → (∀ d. Data d ⇒ d → u) → IP → u # gmapM ∷ Monad m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP # gmapMp ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP # gmapMo ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → IP → m IP # | |
IsString IP | |
Defined in Data.IP.Addr fromString ∷ String → IP # | |
Enum IP | |
Generic IP | |
Read IP | |
Show IP | |
Eq IP | Equality over IP addresses. Correctly compare IPv4 and IPv4-embedded-in-IPv6 addresses.
|
Ord IP | |
type Rep IP | |
Defined in Data.IP.Addr type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.12-7e6c7236f52e47d853564e9d1065d94de4fcb7a87d1339acf7a9018fdf58b700" '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
LedgerPeers | |
| |
BeforeSlot | No result because the node is still before the configured UseLedgerAfter slot number |
Instances
Show LedgerPeers Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common showsPrec ∷ Int → LedgerPeers → ShowS # show ∷ LedgerPeers → String # showList ∷ [LedgerPeers] → ShowS # | |
Eq LedgerPeers Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common (==) ∷ LedgerPeers → LedgerPeers → Bool # (/=) ∷ LedgerPeers → LedgerPeers → Bool # |
getLedgerPeers ∷ MonadSTM m ⇒ LedgerPeersConsensusInterface m → AfterSlot → STM 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 theslotNo
;- '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
pattern RelayDomainAccessPoint ∷ DomainAccessPoint → RelayAccessPoint |
|
Instances
The relative stake of a stakepool in relation to the total amount staked. A value in the [0, 1] range.
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].
Instances
Num AccPoolStake | |
Fractional AccPoolStake | |
Show AccPoolStake | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type showsPrec ∷ Int → AccPoolStake → ShowS # show ∷ AccPoolStake → String # showList ∷ [AccPoolStake] → ShowS # | |
Eq AccPoolStake | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type (==) ∷ AccPoolStake → AccPoolStake → Bool # (/=) ∷ AccPoolStake → AccPoolStake → Bool # | |
Ord AccPoolStake | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type compare ∷ AccPoolStake → AccPoolStake → Ordering # (<) ∷ AccPoolStake → AccPoolStake → Bool # (<=) ∷ AccPoolStake → AccPoolStake → Bool # (>) ∷ AccPoolStake → AccPoolStake → Bool # (>=) ∷ AccPoolStake → AccPoolStake → Bool # max ∷ AccPoolStake → AccPoolStake → AccPoolStake # min ∷ AccPoolStake → AccPoolStake → AccPoolStake # |
data TraceLedgerPeers Source #
Trace LedgerPeers events.
Instances
Show TraceLedgerPeers Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common showsPrec ∷ Int → TraceLedgerPeers → ShowS # show ∷ TraceLedgerPeers → String # showList ∷ [TraceLedgerPeers] → ShowS # |
newtype NumberOfPeers Source #
Instances
Show NumberOfPeers Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common showsPrec ∷ Int → NumberOfPeers → ShowS # show ∷ NumberOfPeers → String # showList ∷ [NumberOfPeers] → ShowS # |
data LedgerPeersKind Source #
Which ledger peers to pick.
Instances
Show LedgerPeersKind Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Common showsPrec ∷ Int → LedgerPeersKind → ShowS # show ∷ LedgerPeersKind → String # showList ∷ [LedgerPeersKind] → ShowS # |
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).
accBigPoolStake ∷ [(PoolStake, NonEmpty RelayAccessPoint)] → Map AccPoolStake (PoolStake, NonEmpty RelayAccessPoint) Source #
Convert a list of pools with stake to a Map keyed on the accumulated stake which only contains big ledger peers, e.g. largest ledger peers which cumulatively control 90% of stake.
bigLedgerPeerQuota ∷ AccPoolStake Source #
The total accumulated stake of big ledger peers.
DNS based provider for ledger root peers
data WithLedgerPeersArgs m Source #
Argument record for withLedgerPeers
WithLedgerPeersArgs | |
|
withLedgerPeers ∷ ∀ peerAddr resolver exception m a. (MonadAsync m, MonadThrow m, MonadMonotonicTime m, Exception exception, Ord peerAddr) ⇒ PeerActionsDNS peerAddr resolver exception m → WithLedgerPeersArgs 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.
Internal only exported for testing purposes
resolveLedgerPeers ∷ ∀ m peerAddr resolver exception. (Ord peerAddr, MonadThrow m, MonadAsync m, Exception exception) ⇒ Tracer m TraceLedgerPeers → (IP → PortNumber → peerAddr) → DNSSemaphore m → ResolvConf → DNSActions resolver exception m → [DomainAccessPoint] → m (Map DomainAccessPoint (Set peerAddr)) Source #
Provides DNS resolution functionality.
Concurrently resolve DNS names, respecting the maxDNSConcurrency
limit.