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

Ouroboros.Network.PeerSelection.KnownPeers

Synopsis

Types

data KnownPeers peeraddr Source #

The set of known peers. To a first approximation it can be thought of as a Set of peeraddr.

It has two special features:

  • It tracks which peers we are permitted to gossip with now, or for peers we cannot gossip with now the time at which we would next be allowed to do so.
  • It tracks the subset of peers that we are happy to publish in reply to gossip requests to our node. It supports random sampling from this set.

Instances

Instances details
Show peeraddr ⇒ Show (KnownPeers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.KnownPeers

Methods

showsPrecIntKnownPeers peeraddr → ShowS Source #

showKnownPeers peeraddr → String Source #

showList ∷ [KnownPeers peeraddr] → ShowS Source #

invariantOrd peeraddr ⇒ KnownPeers peeraddr → Bool Source #

Basic container operations

emptyKnownPeers peeraddr Source #

sizeKnownPeers peeraddr → Int Source #

insertOrd peeraddr ⇒ Set peeraddr → KnownPeers peeraddr → KnownPeers peeraddr Source #

deleteOrd peeraddr ⇒ Set peeraddr → KnownPeers peeraddr → KnownPeers peeraddr Source #

toSetKnownPeers peeraddr → Set peeraddr Source #

O(n)

memberOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → Bool Source #

Special operations

setCurrentTimeOrd peeraddr ⇒ Time → KnownPeers peeraddr → KnownPeers peeraddr Source #

incrementFailCountOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → (Int, KnownPeers peeraddr) Source #

resetFailCountOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → KnownPeers peeraddr Source #

lookupFailCountOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → Maybe Int Source #

lookupTepidFlagOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → Maybe Bool Source #

setTepidFlagOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → KnownPeers peeraddr Source #

clearTepidFlagOrd peeraddr ⇒ peeraddr → KnownPeers peeraddr → KnownPeers peeraddr Source #

Tracking when we can gossip

minGossipTimeOrd peeraddr ⇒ KnownPeers peeraddr → Maybe Time Source #

The first time that a peer will become available for gossip. If peers are already available for gossip, or there are no known peers at all then the result is Nothing.

setGossipTimeOrd peeraddr ⇒ Set peeraddr → Time → KnownPeers peeraddr → KnownPeers peeraddr Source #

availableForGossipKnownPeers peeraddr → Set peeraddr Source #

The subset of known peers that we would be allowed to gossip with now. This is because we have not gossiped with them recently.

Tracking when we can (re)connect

minConnectTimeOrd peeraddr ⇒ KnownPeers peeraddr → Maybe Time Source #

setConnectTimeOrd peeraddr ⇒ Set peeraddr → Time → KnownPeers peeraddr → KnownPeers peeraddr Source #

availableToConnectKnownPeers peeraddr → Set peeraddr Source #

The subset of known peers that we would be allowed to try to establish a connection to now. This is because we have not connected with them before or because any failure backoff time has expired.