| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- data BlockFetchResources (m ∷ Type → Type) blk = BlockFetchResources {
- bfrServer ∷ BlockFetchServer blk (Point blk) m ()
- bfrTickStarted ∷ STM m ()
- data ChainSyncResources (m ∷ Type → Type) blk = ChainSyncResources {
- csrCurrentIntersection ∷ StrictTVar m (Point blk)
- csrServer ∷ ChainSyncServer (Header blk) (Point blk) (Tip blk) m ()
- csrTickStarted ∷ STM m ()
- data PeerResources (m ∷ Type → Type) blk = PeerResources {
- prShared ∷ SharedResources m blk
- prChainSync ∷ ChainSyncResources m blk
- prBlockFetch ∷ BlockFetchResources m blk
- prUpdateState ∷ NodeState blk → STM m ()
- data PeerSimulatorResources (m ∷ Type → Type) blk = PeerSimulatorResources {
- psrPeers ∷ Map PeerId (PeerResources m blk)
- psrHandles ∷ ChainSyncClientHandleCollection PeerId m blk
- data SharedResources (m ∷ Type → Type) blk = SharedResources {
- srPeerId ∷ PeerId
- srBlockTree ∷ BlockTree blk
- srCurrentState ∷ StrictTVar m (Maybe (NodeState blk))
- srTracer ∷ Tracer m (TraceEvent blk)
- makeChainSyncResources ∷ (IOLike m, GetHeader blk, HasHeader blk, Eq blk) ⇒ STM m () → SharedResources m blk → m (ChainSyncResources m blk)
- makePeerResources ∷ (IOLike m, HasHeader blk, GetHeader blk, Eq blk) ⇒ Tracer m (TraceEvent blk) → BlockTree blk → PeerId → m (PeerResources m blk)
- makePeerSimulatorResources ∷ (IOLike m, LedgerSupportsProtocol blk, Eq blk) ⇒ Tracer m (TraceEvent blk) → BlockTree blk → NonEmpty PeerId → m (PeerSimulatorResources m blk)
Documentation
data BlockFetchResources (m ∷ Type → Type) 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 ∷ Type → Type) 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 ∷ Type → Type) 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 ∷ Type → Type) blk Source #
Resources for the peer simulator.
Constructors
| PeerSimulatorResources | |
Fields
| |
data SharedResources (m ∷ Type → Type) blk Source #
Resources used by both ChainSync and BlockFetch for a single peer.
Constructors
| SharedResources | |
Fields
| |
makeChainSyncResources ∷ (IOLike m, GetHeader blk, HasHeader blk, Eq blk) ⇒ STM m () → SharedResources m blk → m (ChainSyncResources m blk) 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, HasHeader blk, GetHeader blk, Eq blk) ⇒ Tracer m (TraceEvent blk) → BlockTree blk → PeerId → m (PeerResources m blk) 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, LedgerSupportsProtocol blk, Eq blk) ⇒ Tracer m (TraceEvent blk) → BlockTree blk → NonEmpty PeerId → m (PeerSimulatorResources m blk) Source #
Create resources for all given peers operating on the given block tree.