Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype PeerGraph = PeerGraph [(PeerAddr, [PeerAddr], PeerInfo)]
- validPeerGraph :: PeerGraph -> Bool
- allPeers :: PeerGraph -> Set PeerAddr
- peerShareReachablePeers :: PeerGraph -> Set PeerAddr -> Set PeerAddr
- data GovernorScripts = GovernorScripts {}
- type PeerShareScript = Script (Maybe ([PeerAddr], PeerShareTime))
- type ConnectionScript = TimedScript AsyncDemotion
- type PeerSharingScript = Script PeerSharing
- data AsyncDemotion
- data PeerShareTime
- interpretPeerShareTime :: PeerShareTime -> DiffTime
- prop_shrink_GovernorScripts :: ShrinkCarefully GovernorScripts -> Property
- prop_arbitrary_PeerGraph :: PeerGraph -> Property
- prop_shrink_PeerGraph :: ShrinkCarefully PeerGraph -> Property
- prop_shrink_nonequal_PeerGraph :: ShrinkCarefully PeerGraph -> Property
- prop_shrink_nonequal_GovernorScripts :: ShrinkCarefully GovernorScripts -> Property
Documentation
The peer graph is the graph of all the peers in the mock p2p network, in traditional adjacency representation.
validPeerGraph :: PeerGraph -> Bool Source #
Invariant. Used to check the QC generator and shrinker.
data GovernorScripts Source #
Instances
Arbitrary GovernorScripts Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph arbitrary :: Gen GovernorScripts # shrink :: GovernorScripts -> [GovernorScripts] # | |
Show GovernorScripts Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph showsPrec :: Int -> GovernorScripts -> ShowS # show :: GovernorScripts -> String # showList :: [GovernorScripts] -> ShowS # | |
Eq GovernorScripts Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph (==) :: GovernorScripts -> GovernorScripts -> Bool # (/=) :: GovernorScripts -> GovernorScripts -> Bool # |
type PeerShareScript = Script (Maybe ([PeerAddr], PeerShareTime)) Source #
The peer sharing script is the script we interpret to provide answers to peer share requests that the governor makes. After each peer share request to a peer we move on to the next entry in the script, unless we get to the end in which case that becomes the reply for all remaining peer share requests.
A Nothing
indicates failure. The [PeerAddr]
is the list of peers to
return which must always be a subset of the actual edges in the p2p graph.
This representation was chosen because it allows easy shrinking.
type ConnectionScript = TimedScript AsyncDemotion Source #
Connection script is the script which provides asynchronous demotions either to cold or warm peer.
type PeerSharingScript = Script PeerSharing Source #
PeerSharing script is the script which provides PeerSharing values when a new connection is established.
data AsyncDemotion Source #
Instances
Arbitrary AsyncDemotion Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph arbitrary :: Gen AsyncDemotion # shrink :: AsyncDemotion -> [AsyncDemotion] # | |
Show AsyncDemotion Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph showsPrec :: Int -> AsyncDemotion -> ShowS # show :: AsyncDemotion -> String # showList :: [AsyncDemotion] -> ShowS # | |
Eq AsyncDemotion Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerGraph (==) :: AsyncDemotion -> AsyncDemotion -> Bool # (/=) :: AsyncDemotion -> AsyncDemotion -> Bool # |
data PeerShareTime Source #
The peer sharing time is our simulation of elapsed time to respond to peer share requests. This is important because the governor uses timeouts and behaves differently in these three cases.