ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.PipelineDecision

Synopsis

Documentation

data PipelineDecision (n :: N) where Source #

Pipeline decision: we can do either one of these:

  • non-pipelined request
  • pipeline a request
  • collect or pipeline, but only when there are pipelined requests
  • collect, as above, only when there are pipelined requests

There might be other useful pipelining scenarios: collect a given number of requests (which also can be used to collect all outstanding requests).

Constructors

Request :: PipelineDecision 'Z 
Pipeline :: forall (n :: N). PipelineDecision n 
CollectOrPipeline :: forall (n1 :: N). PipelineDecision ('S n1) 
Collect :: forall (n1 :: N). PipelineDecision ('S n1) 

data MkPipelineDecision where Source #

The callback gets the following arguments:

  • how many requests are not yet collected (in flight or already queued)
  • block number of client's tip
  • block number of server's tip

Client's tip block number and server's tip block number can only be equal (from the client's perspective) when both the client's and the server's tip headers agree. If they would not agree (server forked), then the server sends MsgRollBackward, which rolls back one block and causes the client's tip and the server's tip to differ.

In this module we implement three pipelining strategies:

pipelineDecisionMax :: forall (n :: N). Word16 -> Nat n -> WithOrigin BlockNo -> WithOrigin BlockNo -> PipelineDecision n Source #

Present maximal pipelining of at most omax requests. Collect responses either when we are at the same block number as the server or when we sent more than omax requests.

If omax = 3 this pipelining strategy will generate a sequence: Pipeline Pipeline Pipeline Collect Pipeline Collect .... Pipeline Collect Collect Collect

pipelineDecisionMin :: forall (n :: N). Word16 -> Nat n -> WithOrigin BlockNo -> WithOrigin BlockNo -> PipelineDecision n Source #

Present minimum pipelining of at most omax requests, collect responses eagerly.

pipelineDecisionLowHighMark :: Word16 -> Word16 -> MkPipelineDecision Source #

Pipelining strategy which pipelines up to highMark requests; if the number of pipelined messages exceeds the high mark, it collects messages until there are at most lowMark outstanding requests.