consensus-test
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Consensus.PeerSimulator.ScheduledChainSyncServer

Description

A ChainSync protocol server that allows external scheduling of its operations, while deferring the implementation of the message handler logic to a simplified, abstract interface provided as a parameter.

Synopsis

Documentation

data ChainSyncServerHandlers m state blk Source #

Handlers for the request a ChainSync server might receive from a client. These take an abstract argument that corresponds to the state of a point schedule tick and return the simplified protocol message types.

See runHandlerWithTrace for the meaning of [String].

Constructors

ChainSyncServerHandlers 

Fields

data FindIntersect blk Source #

Pure representation of the messages produced by the handler for the StIntersect protocol state of a ChainSync server.

Constructors

IntersectFound (Point blk) (Tip blk) 
IntersectNotFound (Tip blk) 

data RequestNext blk Source #

Pure representation of the messages produced by the handler for the StNext protocol state of a ChainSync server.

Constructors

RollForward (Header blk) (Tip blk) 
RollBackward (Point blk) (Tip blk) 
AwaitReply 

data ScheduledChainSyncServer m state blk Source #

Resources used by a ChainSync server mock.

runScheduledChainSyncServerIOLike m ⇒ PeerIdSTM m () → STM m (Maybe (NodeState blk)) → Tracer m (TraceEvent blk) → ChainSyncServerHandlers m (NodeState blk) blk → ChainSyncServer (Header blk) (Point blk) (Tip blk) m () Source #

Construct a ChainSync server for the peer simulator.

See scheduledChainSyncServer.