ouroboros-network-protocols:testlib
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.BlockFetch.Examples

Synopsis

Documentation

constantBlockFetchReceiver Source #

Arguments

:: Functor m 
=> (block -> m ())

handle block

-> m ()

handle MsgBatchDone

-> BlockFetchReceiver block m 

blockFetchClientMap :: forall block point (m :: Type -> Type). MonadSTM m => [ChainRange point] -> BlockFetchClient block point m [block] Source #

A BlockFetchClient designed for testing, which accumulates incoming blocks in a StrictTVar, which is read on termination.

Returns a list of bodies received from the server, from the newest to oldest.

blockFetchClientPipelinedMax :: forall block point (m :: Type -> Type). Monad m => [ChainRange point] -> BlockFetchClientPipelined block point m [Either (ChainRange point) [block]] Source #

A pipelined block-fetch client which sends eagerly a list of requests. This presents maximum pipelining and presents minmimum choice to the environment (drivers).

It returns the interleaving of `ChainRange point` requests and list of received block bodies in the order from newest to oldest (received block bodies are also ordered in this way).

blockFetchClientPipelinedMin :: forall block point (m :: Type -> Type). Monad m => [ChainRange point] -> BlockFetchClientPipelined block point m [Either (ChainRange point) [block]] Source #

A pipelined block-fetch client that sends eagerly but always tries to collect any replies as soon as they are available. This keeps pipelining to bare minimum, and gives maximum choice to the environment (drivers).

It returns the interleaving of `ChainRange point` requests and list of received block bodies in the order from newest to oldest (received block bodies are also ordered in this way).

blockFetchClientPipelinedLimited :: forall block point (m :: Type -> Type). Monad m => Int -> [ChainRange point] -> BlockFetchClientPipelined block point m [Either (ChainRange point) [block]] Source #

A pipelined block-fetch client that sends eagerly up to some maximum limit of outstanding requests. It is also always ready to collect any replies if they are available. This allows limited pipelining and correspondingly limited choice to the environment (drivers).

It returns the interleaving of `ChainRange point` requests and list of received block bodies in the order from newest to oldest (received block bodies are also ordered in this way).

newtype RangeRequests (m :: Type -> Type) block Source #

A recursive control data type which encodes a succession of ChainRange block requests.

Constructors

RangeRequests 

Fields

constantRangeRequests :: forall (m :: Type -> Type) block. Monad m => (ChainRange (Point block) -> Producer block m ()) -> RangeRequests m block Source #

A constant RangeRequests object.

rangeRequestsFromChain :: forall (m :: Type -> Type) block. (Monad m, HasHeader block) => Chain block -> RangeRequests m block Source #

RangeRequests which requests blocks from a chain. Use Functor instance of RangeRequests to change map block.

blockFetchServer :: forall (m :: Type -> Type) block. Monad m => RangeRequests m block -> BlockFetchServer block (Point block) m () Source #

Construct a BlockFetchServer from a RangeRequest control data type.