ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.ConnectionManager.ConnMap

Synopsis

Documentation

newtype ConnMap peerAddr a Source #

The outer map keys are remote addresses, the internal ones are local addresses.

Constructors

ConnMap 

Fields

Instances

Instances details
Functor (ConnMap peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

fmap :: (a -> b) -> ConnMap peerAddr a -> ConnMap peerAddr b #

(<$) :: a -> ConnMap peerAddr b -> ConnMap peerAddr a #

Foldable (ConnMap peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

fold :: Monoid m => ConnMap peerAddr m -> m #

foldMap :: Monoid m => (a -> m) -> ConnMap peerAddr a -> m #

foldMap' :: Monoid m => (a -> m) -> ConnMap peerAddr a -> m #

foldr :: (a -> b -> b) -> b -> ConnMap peerAddr a -> b #

foldr' :: (a -> b -> b) -> b -> ConnMap peerAddr a -> b #

foldl :: (b -> a -> b) -> b -> ConnMap peerAddr a -> b #

foldl' :: (b -> a -> b) -> b -> ConnMap peerAddr a -> b #

foldr1 :: (a -> a -> a) -> ConnMap peerAddr a -> a #

foldl1 :: (a -> a -> a) -> ConnMap peerAddr a -> a #

toList :: ConnMap peerAddr a -> [a] #

null :: ConnMap peerAddr a -> Bool #

length :: ConnMap peerAddr a -> Int #

elem :: Eq a => a -> ConnMap peerAddr a -> Bool #

maximum :: Ord a => ConnMap peerAddr a -> a #

minimum :: Ord a => ConnMap peerAddr a -> a #

sum :: Num a => ConnMap peerAddr a -> a #

product :: Num a => ConnMap peerAddr a -> a #

Traversable (ConnMap peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

traverse :: Applicative f => (a -> f b) -> ConnMap peerAddr a -> f (ConnMap peerAddr b) #

sequenceA :: Applicative f => ConnMap peerAddr (f a) -> f (ConnMap peerAddr a) #

mapM :: Monad m => (a -> m b) -> ConnMap peerAddr a -> m (ConnMap peerAddr b) #

sequence :: Monad m => ConnMap peerAddr (m a) -> m (ConnMap peerAddr a) #

(Show peerAddr, Show a) => Show (ConnMap peerAddr a) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

showsPrec :: Int -> ConnMap peerAddr a -> ShowS #

show :: ConnMap peerAddr a -> String #

showList :: [ConnMap peerAddr a] -> ShowS #

data LocalAddr peerAddr Source #

Constructors

UnknownLocalAddr

A reserved slot for an outbound connection which is being created. The outbound connection must be in the ReservedOutbound state.

LocalAddr peerAddr

All connections which are not in the ReservedOutbound state use LocalAddr, since for them the local address is known.

Instances

Instances details
Show peerAddr => Show (LocalAddr peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

showsPrec :: Int -> LocalAddr peerAddr -> ShowS #

show :: LocalAddr peerAddr -> String #

showList :: [LocalAddr peerAddr] -> ShowS #

Eq peerAddr => Eq (LocalAddr peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

(==) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

(/=) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

Ord peerAddr => Ord (LocalAddr peerAddr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.ConnMap

Methods

compare :: LocalAddr peerAddr -> LocalAddr peerAddr -> Ordering #

(<) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

(<=) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

(>) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

(>=) :: LocalAddr peerAddr -> LocalAddr peerAddr -> Bool #

max :: LocalAddr peerAddr -> LocalAddr peerAddr -> LocalAddr peerAddr #

min :: LocalAddr peerAddr -> LocalAddr peerAddr -> LocalAddr peerAddr #

toList :: ConnMap m a -> [a] Source #

toMap :: Ord peerAddr => ConnMap peerAddr a -> Map (ConnectionId peerAddr) a Source #

Create a map of all connections with a known ConnectionId.

empty :: ConnMap peerAddr a Source #

insert :: Ord peerAddr => ConnectionId peerAddr -> a -> ConnMap peerAddr a -> ConnMap peerAddr a Source #

insertUnknownLocalAddr :: Ord peerAddr => peerAddr -> a -> ConnMap peerAddr a -> ConnMap peerAddr a Source #

delete :: Ord peerAddr => ConnectionId peerAddr -> ConnMap peerAddr a -> ConnMap peerAddr a Source #

deleteAtRemoteAddr Source #

Arguments

:: (Ord peerAddr, Eq a) 
=> peerAddr

remoteAddr

-> a

element to remove

-> ConnMap peerAddr a 
-> ConnMap peerAddr a 

lookup :: Ord peerAddr => ConnectionId peerAddr -> ConnMap peerAddr a -> Maybe a Source #

lookupByRemoteAddr Source #

Arguments

:: forall rnd peerAddr a. (Ord peerAddr, RandomGen rnd) 
=> rnd

a fresh rnd (it must come from a split)

-> peerAddr

remote address

-> ConnMap peerAddr a 
-> Maybe a 

Find a random entry for a given remote address.

NOTE: the outbound governor will only ask for a connection to a peer if it doesn't have one (and one isn't being created). This property, simplifies lookupOutbound: we can pick (randomly) one of the connections to the remote peer. When the outbound governor is asking, likely all of the connections are in an inbound state. The outbound governor will has a grace period after demoting a peer, so a race (when a is being demoted and promoted at the same time) is unlikely.

updateLocalAddr Source #

Arguments

:: Ord peerAddr 
=> ConnectionId peerAddr 
-> ConnMap peerAddr a 
-> (Bool, ConnMap peerAddr a)

Return True iff the entry was updated.

traverseMaybe :: Applicative f => (a -> f (Maybe b)) -> ConnMap peerAddr a -> f [b] Source #