ouroboros-network-protocols:testlib
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.ExamplesPipelined

Synopsis

Documentation

data Client header point tip (m :: Type -> Type) t Source #

Constructors

Client 

Fields

chainSyncClientPipelinedMax Source #

Arguments

:: forall header (m :: Type -> Type) a. (HasHeader header, MonadSTM m) 
=> Word16

maximal number of outstanding requests

-> StrictTVar m (Chain header) 
-> Client header (Point header) (Tip header) m a 
-> ChainSyncClientPipelined header (Point header) (Tip header) m a 

A pipelined chain-sync client that sends eagerly up omax pipelined request and then collects all responses and starts over again. This presents maximum pipelining and presents minimum choice to the environment (drivers).

This client is only useful in tests and reference implementation: it is using mock representation of a chain.

If omax is equal to 3 the communication will look like (if the client is far from server's tip; pipelining is presented with long pauses to ilustrate when messages will be collected).

'MsgFindIntersect' ↘ │ ╲    │
                     │  ╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgIntersectFound' or 'MsgIntersectNotFound'
                     │    ╱ │
                     │   ╱  │
                     │  ╱   │
  'MsgRequestNext' ↘ │ ╱    │
                     │ ╲    │
                     │  ╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
  'MsgRequestNext' ↘ │   ╱  │
                     │ ╲╱   │
                     │ ╱╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
                     │   ╱  │
  'MsgRequestNext' ↘ │ ╲╱   │
                     │ ╱╲   │
         'Collect' ↙ │╱  ╲  │
  'MsgRequestNext' ↘ │╲     │
                     ┆      ┆

                     ┆      ┆
         'Collect' ↙ │╱  ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
                     │   ╱  │
                     │  ╱   │
         'Collect' ↙ │ ╱    │
                     │      │

chainSyncClientPipelinedMin Source #

Arguments

:: forall header (m :: Type -> Type) a. (HasHeader header, MonadSTM m) 
=> Word16

maximal number of outstanding requests

-> StrictTVar m (Chain header) 
-> Client header (Point header) (Tip header) m a 
-> ChainSyncClientPipelined header (Point header) (Tip header) m a 

A pipelined chain-sycn client that pipelines at most omax requests and 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).

If omax is equal to 3 the communication will look like (if the client is far from server's tip; pipelining is presented with long pauses to ilustrate when messages will be collected).

'MsgFindIntersect' ↘ │ ╲    │
                     │  ╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgIntersectFound' or 'MsgIntersectNotFound'
                     │    ╱ │
                     │   ╱  │
                     │  ╱   │
  'MsgRequestNext' ↘ │ ╱    │
                     │ ╲    │
                     │  ╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
  'MsgRequestNext' ↘ │   ╱  │
                     │ ╲╱   │
         'Collect' ↙ │ ╱╲   │
                     │   ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
                     │   ╱  │
  'MsgRequestNext' ↘ │ ╲╱   │
                     │ ╱╲   │
         'Collect' ↙ │   ╲  │
                     │    ╲ │ ↙ 'MsgRollForward' or 'MsgRollBackward'
                     │    ╱ │
                     │   ╱  │
                     │  ╱   │
         'Collect' ↙ │ ╱    │
                     │      │

chainSyncClientPipelinedLowHigh Source #

Arguments

:: forall header (m :: Type -> Type) a. (HasHeader header, MonadSTM m) 
=> Word16

low mark

-> Word16

high mark

-> StrictTVar m (Chain header) 
-> Client header (Point header) (Tip header) m a 
-> ChainSyncClientPipelined header (Point header) (Tip header) m a