ouroboros-network-0.1.0.1: A networking layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Network.Protocol.ChainSync.PipelineDecision

Synopsis

Documentation

data PipelineDecision 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).

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 :: Word32 -> 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 :: Word32 -> Nat n -> WithOrigin BlockNo -> WithOrigin BlockNo -> PipelineDecision n Source #

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

pipelineDecisionLowHighMark :: Word32 -> Word32 -> 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.