consensus-test
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Consensus.PeerSimulator.Resources

Description

Data types and resource allocating constructors for the concurrency primitives used by ChainSync and BlockFetch in the handlers that implement the block tree analysis specific to our peer simulator.

Synopsis

Documentation

data BlockFetchResources m blk Source #

The data used by the point scheduler to interact with the mocked protocol handler in Test.Consensus.PeerSimulator.BlockFetch.

Constructors

BlockFetchResources 

Fields

data ChainSyncResources m blk Source #

The data used by the point scheduler to interact with the mocked protocol handler in Test.Consensus.PeerSimulator.ScheduledChainSyncServer.

Constructors

ChainSyncResources 

Fields

data PeerResources m blk Source #

The totality of resources used by a single peer in ChainSync and BlockFetch and by the scheduler to interact with it.

Constructors

PeerResources 

Fields

data PeerSimulatorResources m blk Source #

Resources for the peer simulator.

Constructors

PeerSimulatorResources 

Fields

data SharedResources m blk Source #

Resources used by both ChainSync and BlockFetch for a single peer.

Constructors

SharedResources 

Fields

makeChainSyncResourcesIOLike m ⇒ STM m () → SharedResources m TestBlock → m (ChainSyncResources m TestBlock) Source #

Create all the resources used exclusively by the ChainSync handlers, and the ChainSync protocol server that uses the handlers to interface with the typed-protocols engine.

TODO move server construction to Run?

makePeerResourcesIOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlockPeerId → m (PeerResources m TestBlock) Source #

Create all concurrency resources and the ChainSync protocol server used for a single peer.

A peer performs BlockFetch and ChainSync using a state of type NodeState that is updated by a separate scheduler, waking up the protocol handlers to process messages until the conditions of the new state are satisfied.

TODO pass BFR and CSR to runScheduled... rather than passing the individual resources in and storing the result

makePeerSimulatorResourcesIOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlockNonEmpty PeerId → m (PeerSimulatorResources m TestBlock) Source #

Create resources for all given peers operating on the given block tree.