module Ouroboros.Consensus.Ledger.SupportsPeerSelection (
LedgerSupportsPeerSelection (..)
, PoolStake (..)
, StakePoolRelay (..)
, stakePoolRelayAccessPoint
, DomainAccessPoint (..)
, IP (..)
, PortNumber
, RelayAccessPoint (..)
) where
import Control.DeepSeq (NFData (..))
import Data.List.NonEmpty (NonEmpty)
import Ouroboros.Consensus.Ledger.Abstract (LedgerState)
import Ouroboros.Network.PeerSelection.LedgerPeers.Type
(PoolStake (..))
import Ouroboros.Network.PeerSelection.RelayAccessPoint
(DomainAccessPoint (..), IP (..), PortNumber,
RelayAccessPoint (..))
data StakePoolRelay =
CurrentRelay RelayAccessPoint
| FutureRelay RelayAccessPoint
deriving (Int -> StakePoolRelay -> ShowS
[StakePoolRelay] -> ShowS
StakePoolRelay -> String
(Int -> StakePoolRelay -> ShowS)
-> (StakePoolRelay -> String)
-> ([StakePoolRelay] -> ShowS)
-> Show StakePoolRelay
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StakePoolRelay -> ShowS
showsPrec :: Int -> StakePoolRelay -> ShowS
$cshow :: StakePoolRelay -> String
show :: StakePoolRelay -> String
$cshowList :: [StakePoolRelay] -> ShowS
showList :: [StakePoolRelay] -> ShowS
Show, StakePoolRelay -> StakePoolRelay -> Bool
(StakePoolRelay -> StakePoolRelay -> Bool)
-> (StakePoolRelay -> StakePoolRelay -> Bool) -> Eq StakePoolRelay
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StakePoolRelay -> StakePoolRelay -> Bool
== :: StakePoolRelay -> StakePoolRelay -> Bool
$c/= :: StakePoolRelay -> StakePoolRelay -> Bool
/= :: StakePoolRelay -> StakePoolRelay -> Bool
Eq)
instance NFData StakePoolRelay where
rnf :: StakePoolRelay -> ()
rnf (CurrentRelay RelayAccessPoint
ra) = RelayAccessPoint -> ()
forall a. NFData a => a -> ()
rnf RelayAccessPoint
ra
rnf (FutureRelay RelayAccessPoint
ra) = RelayAccessPoint -> ()
forall a. NFData a => a -> ()
rnf RelayAccessPoint
ra
stakePoolRelayAccessPoint :: StakePoolRelay -> RelayAccessPoint
stakePoolRelayAccessPoint :: StakePoolRelay -> RelayAccessPoint
stakePoolRelayAccessPoint (CurrentRelay RelayAccessPoint
ra) = RelayAccessPoint
ra
stakePoolRelayAccessPoint (FutureRelay RelayAccessPoint
ra) = RelayAccessPoint
ra
class LedgerSupportsPeerSelection blk where
getPeers :: LedgerState blk -> [(PoolStake, NonEmpty StakePoolRelay)]