Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.PeerSelection.LedgerPeers.Type
Contents
Description
Various types related to ledger peers. This module is re-exported from Ouroboros.Network.PeerSelection.LedgerPeers.
Synopsis
- newtype PoolStake = PoolStake {}
- newtype AccPoolStake = AccPoolStake {}
- data IsLedgerPeer
- data IsBigLedgerPeer
- data LedgerPeersConsensusInterface extraAPI (m :: Type -> Type) = LedgerPeersConsensusInterface {
- lpGetLatestSlot :: STM m (WithOrigin SlotNo)
- lpGetLedgerPeers :: STM m [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
- lpExtraAPI :: extraAPI
- getRelayAccessPointsFromLedger :: forall (m :: Type -> Type) extraAPI. MonadSTM m => SRVPrefix -> LedgerPeersConsensusInterface extraAPI m -> STM m [(PoolStake, NonEmpty RelayAccessPoint)]
- mapExtraAPI :: forall a b (m :: Type -> Type). (a -> b) -> LedgerPeersConsensusInterface a m -> LedgerPeersConsensusInterface b m
- data UseLedgerPeers
- data AfterSlot
- data LedgerPeersKind
- data LedgerPeerSnapshot where
- LedgerPeerSnapshotV2 (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))])
- pattern LedgerPeerSnapshot :: (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]) -> LedgerPeerSnapshot
- data LedgerPeerSnapshotSRVSupport
- encodeLedgerPeerSnapshot :: LedgerPeerSnapshotSRVSupport -> LedgerPeerSnapshot -> Encoding
- decodeLedgerPeerSnapshot :: LedgerPeerSnapshotSRVSupport -> Decoder s LedgerPeerSnapshot
- getRelayAccessPointsFromLedgerPeerSnapshot :: SRVPrefix -> LedgerPeerSnapshot -> (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))])
- isLedgerPeersEnabled :: UseLedgerPeers -> Bool
- compareLedgerPeerSnapshotApproximate :: [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))] -> [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))] -> Bool
- type SRVPrefix = Domain
- data RelayAccessPoint
- data LedgerRelayAccessPoint
- prefixLedgerRelayAccessPoint :: SRVPrefix -> LedgerRelayAccessPoint -> RelayAccessPoint
Documentation
The relative stake of a stakepool in relation to the total amount staked. A value in the [0, 1] range.
Constructors
PoolStake | |
Fields |
Instances
NFData PoolStake Source # | |
Num PoolStake Source # | |
Fractional PoolStake Source # | |
Show PoolStake Source # | |
Eq PoolStake Source # | |
Ord PoolStake Source # | |
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].
Constructors
AccPoolStake | |
Fields |
Instances
data IsLedgerPeer Source #
Identifies a peer as coming from ledger or not.
Constructors
IsLedgerPeer | a ledger peer. |
IsNotLedgerPeer |
Instances
Show IsLedgerPeer Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods showsPrec :: Int -> IsLedgerPeer -> ShowS # show :: IsLedgerPeer -> String # showList :: [IsLedgerPeer] -> ShowS # | |
Eq IsLedgerPeer Source # | |
data IsBigLedgerPeer Source #
A boolean like type. Big ledger peers are the largest SPOs which control 90% of staked stake.
Note that IsBigLedgerPeer
indicates a role that peer plays in the eclipse
evasion, e.g. that a peer was explicitly selected as a big ledger peer, e.g.
IsNotBigLedgerPeer
does not necessarily mean that the peer isn't a big
ledger peer. This is because we select root peers from all ledger peers
(including big ones).
Constructors
IsBigLedgerPeer | |
IsNotBigLedgerPeer |
Instances
Show IsBigLedgerPeer Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods showsPrec :: Int -> IsBigLedgerPeer -> ShowS # show :: IsBigLedgerPeer -> String # showList :: [IsBigLedgerPeer] -> ShowS # | |
Eq IsBigLedgerPeer Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods (==) :: IsBigLedgerPeer -> IsBigLedgerPeer -> Bool # (/=) :: IsBigLedgerPeer -> IsBigLedgerPeer -> Bool # |
data LedgerPeersConsensusInterface extraAPI (m :: Type -> Type) Source #
Return ledger state information and ledger peers.
Constructors
LedgerPeersConsensusInterface | |
Fields
|
getRelayAccessPointsFromLedger :: forall (m :: Type -> Type) extraAPI. MonadSTM m => SRVPrefix -> LedgerPeersConsensusInterface extraAPI m -> STM m [(PoolStake, NonEmpty RelayAccessPoint)] Source #
mapExtraAPI :: forall a b (m :: Type -> Type). (a -> b) -> LedgerPeersConsensusInterface a m -> LedgerPeersConsensusInterface b m Source #
data UseLedgerPeers Source #
Only use the ledger after the given slot number.
Constructors
DontUseLedgerPeers | |
UseLedgerPeers AfterSlot |
Instances
Only use the ledger after the given slot number.
Instances
Generic AfterSlot Source # | |||||
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Associated Types
| |||||
Show AfterSlot Source # | |||||
Eq AfterSlot Source # | |||||
NoThunks AfterSlot Source # | |||||
type Rep AfterSlot Source # | |||||
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type type Rep AfterSlot = D1 ('MetaData "AfterSlot" "Ouroboros.Network.PeerSelection.LedgerPeers.Type" "ouroboros-network-api-0.16.0.0-inplace" 'False) (C1 ('MetaCons "Always" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "After" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo))) |
data LedgerPeersKind Source #
Which ledger peers to pick.
Constructors
AllLedgerPeers | |
BigLedgerPeers |
Instances
Show LedgerPeersKind Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods showsPrec :: Int -> LedgerPeersKind -> ShowS # show :: LedgerPeersKind -> String # showList :: [LedgerPeersKind] -> ShowS # |
data LedgerPeerSnapshot Source #
The type of big ledger peers that is serialised or later provided by node configuration for the networking layer to connect to when syncing.
Constructors
LedgerPeerSnapshotV2 (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]) | Internal use for version 2, use pattern synonym for public API |
Bundled Patterns
pattern LedgerPeerSnapshot :: (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]) -> LedgerPeerSnapshot | Public API to access snapshot data. Currently access to only most recent version is available. Nonetheless, serialisation from the node into JSON is supported for older versions via internal api so that newer CLI can still support older node formats. |
Instances
FromJSON LedgerPeerSnapshot Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods parseJSON :: Value -> Parser LedgerPeerSnapshot # parseJSONList :: Value -> Parser [LedgerPeerSnapshot] # | |
ToJSON LedgerPeerSnapshot Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods toJSON :: LedgerPeerSnapshot -> Value # toEncoding :: LedgerPeerSnapshot -> Encoding # toJSONList :: [LedgerPeerSnapshot] -> Value # toEncodingList :: [LedgerPeerSnapshot] -> Encoding # omitField :: LedgerPeerSnapshot -> Bool # | |
Show LedgerPeerSnapshot Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods showsPrec :: Int -> LedgerPeerSnapshot -> ShowS # show :: LedgerPeerSnapshot -> String # showList :: [LedgerPeerSnapshot] -> ShowS # | |
Eq LedgerPeerSnapshot Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods (==) :: LedgerPeerSnapshot -> LedgerPeerSnapshot -> Bool # (/=) :: LedgerPeerSnapshot -> LedgerPeerSnapshot -> Bool # |
data LedgerPeerSnapshotSRVSupport Source #
Constructors
LedgerPeerSnapshotSupportsSRV | since |
LedgerPeerSnapshotDoesntSupportSRV |
Instances
Show LedgerPeerSnapshotSRVSupport Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods showsPrec :: Int -> LedgerPeerSnapshotSRVSupport -> ShowS # show :: LedgerPeerSnapshotSRVSupport -> String # showList :: [LedgerPeerSnapshotSRVSupport] -> ShowS # | |
Eq LedgerPeerSnapshotSRVSupport Source # | |
Defined in Ouroboros.Network.PeerSelection.LedgerPeers.Type Methods (==) :: LedgerPeerSnapshotSRVSupport -> LedgerPeerSnapshotSRVSupport -> Bool # (/=) :: LedgerPeerSnapshotSRVSupport -> LedgerPeerSnapshotSRVSupport -> Bool # |
getRelayAccessPointsFromLedgerPeerSnapshot :: SRVPrefix -> LedgerPeerSnapshot -> (WithOrigin SlotNo, [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))]) Source #
compareLedgerPeerSnapshotApproximate :: [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))] -> [(AccPoolStake, (PoolStake, NonEmpty RelayAccessPoint))] -> Bool Source #
Since ledger peer snapshot is serialised with all domain names
fully qualified, and all stake values are approximate in floating
point, comparison is necessarily approximate as well.
The candidate argument is processed here to simulate a round trip
by the serialisation mechanism and then compared to the baseline
argument, which is assumed that it was actually processed this way
when a snapshot was created earlier, and hence it is approximate as well.
The two approximate values should be equal if they were created
from the same faithful
data.
Re-exports
data RelayAccessPoint Source #
A relay can have either an IP address and a port number or a domain with a port number
Constructors
RelayAccessDomain !Domain !PortNumber | |
RelayAccessSRVDomain !Domain | SRV domain, prefixed (as defined in CIP#0155) |
RelayAccessAddress !IP !PortNumber |
Instances
FromJSON RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods parseJSON :: Value -> Parser RelayAccessPoint # parseJSONList :: Value -> Parser [RelayAccessPoint] # | |
ToJSON RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods toJSON :: RelayAccessPoint -> Value # toEncoding :: RelayAccessPoint -> Encoding # toJSONList :: [RelayAccessPoint] -> Value # toEncodingList :: [RelayAccessPoint] -> Encoding # omitField :: RelayAccessPoint -> Bool # | |
FromCBOR RelayAccessPoint Source # | |
ToCBOR RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods toCBOR :: RelayAccessPoint -> Encoding # encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy RelayAccessPoint -> Size # encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [RelayAccessPoint] -> Size # | |
NFData RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods rnf :: RelayAccessPoint -> () # | |
Show RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods showsPrec :: Int -> RelayAccessPoint -> ShowS # show :: RelayAccessPoint -> String # showList :: [RelayAccessPoint] -> ShowS # | |
Eq RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods (==) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (/=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # | |
Ord RelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods compare :: RelayAccessPoint -> RelayAccessPoint -> Ordering # (<) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (<=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (>) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (>=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # max :: RelayAccessPoint -> RelayAccessPoint -> RelayAccessPoint # min :: RelayAccessPoint -> RelayAccessPoint -> RelayAccessPoint # |
data LedgerRelayAccessPoint Source #
A Relay as registered on the ledger.
The only difference with RelayAccessPoint
is that
LedgerRelayAccessSRVDomain
is not prefixed, as required by CIP#0155.
Constructors
LedgerRelayAccessDomain !Domain !PortNumber | |
LedgerRelayAccessSRVDomain !Domain | SRV domain as registered on the ledger |
LedgerRelayAccessAddress !IP !PortNumber |
Instances
FromJSON LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods parseJSON :: Value -> Parser LedgerRelayAccessPoint # parseJSONList :: Value -> Parser [LedgerRelayAccessPoint] # | |
ToJSON LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods toJSON :: LedgerRelayAccessPoint -> Value # toEncoding :: LedgerRelayAccessPoint -> Encoding # toJSONList :: [LedgerRelayAccessPoint] -> Value # toEncodingList :: [LedgerRelayAccessPoint] -> Encoding # omitField :: LedgerRelayAccessPoint -> Bool # | |
FromCBOR LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods fromCBOR :: Decoder s LedgerRelayAccessPoint # label :: Proxy LedgerRelayAccessPoint -> Text # | |
ToCBOR LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods toCBOR :: LedgerRelayAccessPoint -> Encoding # encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy LedgerRelayAccessPoint -> Size # encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [LedgerRelayAccessPoint] -> Size # | |
NFData LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods rnf :: LedgerRelayAccessPoint -> () # | |
Show LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods showsPrec :: Int -> LedgerRelayAccessPoint -> ShowS # show :: LedgerRelayAccessPoint -> String # showList :: [LedgerRelayAccessPoint] -> ShowS # | |
Eq LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods (==) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # (/=) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # | |
Ord LedgerRelayAccessPoint Source # | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods compare :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Ordering # (<) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # (<=) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # (>) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # (>=) :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> Bool # max :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> LedgerRelayAccessPoint # min :: LedgerRelayAccessPoint -> LedgerRelayAccessPoint -> LedgerRelayAccessPoint # |