Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data KnownPeers peeraddr
- invariant :: Ord peeraddr => KnownPeers peeraddr -> Bool
- empty :: KnownPeers peeraddr
- size :: KnownPeers peeraddr -> Int
- insert :: Ord peeraddr => Set peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr
- delete :: Ord peeraddr => Set peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr
- toSet :: KnownPeers peeraddr -> Set peeraddr
- member :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Bool
- setCurrentTime :: Ord peeraddr => Time -> KnownPeers peeraddr -> KnownPeers peeraddr
- incrementFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> ( Int , KnownPeers peeraddr)
- resetFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr
- lookupFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Maybe Int
- lookupTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Maybe Bool
- setTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr
- clearTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr
- minGossipTime :: Ord peeraddr => KnownPeers peeraddr -> Maybe Time
- setGossipTime :: Ord peeraddr => Set peeraddr -> Time -> KnownPeers peeraddr -> KnownPeers peeraddr
- availableForGossip :: KnownPeers peeraddr -> Set peeraddr
- minConnectTime :: Ord peeraddr => KnownPeers peeraddr -> Maybe Time
- setConnectTime :: Ord peeraddr => Set peeraddr -> Time -> KnownPeers peeraddr -> KnownPeers peeraddr
- availableToConnect :: KnownPeers peeraddr -> Set peeraddr
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
Show peeraddr => Show ( KnownPeers peeraddr) Source # | |
Defined in Ouroboros.Network.PeerSelection.KnownPeers |
Basic container operations
empty :: KnownPeers peeraddr Source #
size :: KnownPeers peeraddr -> Int Source #
insert :: Ord peeraddr => Set peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
delete :: Ord peeraddr => Set peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
toSet :: KnownPeers peeraddr -> Set peeraddr Source #
O(n)
Special operations
setCurrentTime :: Ord peeraddr => Time -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
incrementFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> ( Int , KnownPeers peeraddr) Source #
resetFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
lookupFailCount :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Maybe Int Source #
lookupTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> Maybe Bool Source #
setTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
clearTepidFlag :: Ord peeraddr => peeraddr -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
Tracking when we can gossip
minGossipTime :: Ord 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
.
setGossipTime :: Ord peeraddr => Set peeraddr -> Time -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
availableForGossip :: KnownPeers 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
minConnectTime :: Ord peeraddr => KnownPeers peeraddr -> Maybe Time Source #
setConnectTime :: Ord peeraddr => Set peeraddr -> Time -> KnownPeers peeraddr -> KnownPeers peeraddr Source #
availableToConnect :: KnownPeers 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.