Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- data BlockFetchResources m blk = BlockFetchResources {
- bfrServer ∷ BlockFetchServer blk (Point blk) m ()
- bfrTickStarted ∷ STM m ()
- data ChainSyncResources m blk = ChainSyncResources {
- csrCurrentIntersection ∷ StrictTVar m (Point blk)
- csrServer ∷ ChainSyncServer (Header blk) (Point blk) (Tip blk) m ()
- csrTickStarted ∷ STM m ()
- data PeerResources m blk = PeerResources {
- prShared ∷ SharedResources m blk
- prChainSync ∷ ChainSyncResources m blk
- prBlockFetch ∷ BlockFetchResources m blk
- prUpdateState ∷ NodeState blk → STM m ()
- data PeerSimulatorResources m blk = PeerSimulatorResources {
- psrPeers ∷ Map PeerId (PeerResources m blk)
- psrHandles ∷ StrictTVar m (Map PeerId (ChainSyncClientHandle m TestBlock))
- data SharedResources m blk = SharedResources {
- srPeerId ∷ PeerId
- srBlockTree ∷ BlockTree blk
- srCurrentState ∷ StrictTVar m (Maybe (NodeState blk))
- srTracer ∷ Tracer m (TraceEvent blk)
- makeChainSyncResources ∷ IOLike m ⇒ STM m () → SharedResources m TestBlock → m (ChainSyncResources m TestBlock)
- makePeerResources ∷ IOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlock → PeerId → m (PeerResources m TestBlock)
- makePeerSimulatorResources ∷ IOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlock → NonEmpty PeerId → m (PeerSimulatorResources m TestBlock)
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.
BlockFetchResources | |
|
data ChainSyncResources m blk Source #
The data used by the point scheduler to interact with the mocked protocol handler in Test.Consensus.PeerSimulator.ScheduledChainSyncServer.
ChainSyncResources | |
|
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.
PeerResources | |
|
data PeerSimulatorResources m blk Source #
Resources for the peer simulator.
PeerSimulatorResources | |
|
data SharedResources m blk Source #
Resources used by both ChainSync and BlockFetch for a single peer.
SharedResources | |
|
makeChainSyncResources ∷ IOLike 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?
makePeerResources ∷ IOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlock → PeerId → 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
makePeerSimulatorResources ∷ IOLike m ⇒ Tracer m (TraceEvent TestBlock) → BlockTree TestBlock → NonEmpty PeerId → m (PeerSimulatorResources m TestBlock) Source #
Create resources for all given peers operating on the given block tree.