ouroboros-consensus:unstable-diffusion-testlib
Safe HaskellNone
LanguageHaskell2010

Test.ThreadNet.Util.NodeTopology

Synopsis

Node Topology

newtype NodeTopology Source #

Which lesser nodes each node connects to

INVARIANT: for each mapping n -> ms, n > m for each m in ms

INVARIANT: only the mapping for n = CoreNodeId 0 is empty

INVARIANT: there is a mapping for each CoreNodeId in the test, 0 .. n - 1

Note that every node is connected to every other but not necessarily directly. In other words, the topology is always a single network of nodes, which is realistic. With other test configuration components, such as network partitions, the network may split (temporarily or not) into separate connected components during the execution, but the base topology is connected.

Instances

Instances details
Eq NodeTopology Source # 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

Generic NodeTopology Source # 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

Associated Types

type Rep NodeTopology 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

type Rep NodeTopology = D1 ('MetaData "NodeTopology" "Test.ThreadNet.Util.NodeTopology" "ouroboros-consensus-4.0.0.0-inplace-unstable-diffusion-testlib" 'True) (C1 ('MetaCons "NodeTopology" 'PrefixI 'True) (S1 ('MetaSel ('Just "unNodeTopology") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map CoreNodeId (Set CoreNodeId)))))
Show NodeTopology Source # 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

Condense NodeTopology Source # 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

type Rep NodeTopology Source # 
Instance details

Defined in Test.ThreadNet.Util.NodeTopology

type Rep NodeTopology = D1 ('MetaData "NodeTopology" "Test.ThreadNet.Util.NodeTopology" "ouroboros-consensus-4.0.0.0-inplace-unstable-diffusion-testlib" 'True) (C1 ('MetaCons "NodeTopology" 'PrefixI 'True) (S1 ('MetaSel ('Just "unNodeTopology") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map CoreNodeId (Set CoreNodeId)))))

coreNodeIdNeighbors ∷ HasCallStack ⇒ NodeTopology → CoreNodeId → [CoreNodeId] Source #

The neighbors of this node

edgesNodeTopology ∷ NodeTopology → [(CoreNodeId, CoreNodeId)] Source #

The edges in this topology

genNodeTopology Source #

Arguments

∷ HasCallStack 
⇒ NumCoreNodes

PRECONDITION: non-negative

→ Gen NodeTopology 

Generate a NodeTopology consistent with the given properties

meshNodeTopology Source #

Arguments

∷ NumCoreNodes

PRECONDITION: non-negative

→ NodeTopology 

Connect every pair of nodes

minimumDegreeNodeTopology ∷ NodeTopology → Maybe Int Source #

The neighbor count of the node with the fewest neighbors, unless there are zero nodes

shrinkNodeTopology ∷ NodeTopology → [NodeTopology] Source #

Shrink a node topology

The new topologies must be usable with the same number of nodes and slots as the old topology