ouroboros-network-protocols-0.8.1.0: Ouroboros Network Protocols
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.ClientPipelined

Synopsis

Documentation

newtype ChainSyncClientPipelined header point tip m a Source #

Pipelined chain sync client. It can only pipeline MsgRequestNext messages, while the MsgFindIntersect are non pipelined. This has a penalty cost of an RTT, but they are sent relatively seldom and their response might impact how many messages one would like to pipeline. It also simplifies the receiver callback.

Constructors

ChainSyncClientPipelined 

Fields

data ClientPipelinedStIdle n header point tip m a where Source #

Pipelined sender which starts in StIdle state. It can either

  • Send MsgRequestNext (no pipelining), which might be useful when we are at the tip of the chain. It can only be send when there is no pipelined message in flight (all responses were collected);
  • Pipeline MsgRequestNext;
  • Send MsgFindIntersect (no pipelining); It can only be send when there is no pipelined message in flight (all responses were collected);
  • Collect responses of pipelined message;
  • Terminate the protocol with by sending MsgDone.

Constructors

SendMsgRequestNext 

Fields

SendMsgRequestNextPipelined 

Fields

SendMsgFindIntersect ∷ [point] → ClientPipelinedStIntersect header point tip m a → ClientPipelinedStIdle Z header point tip m a 
CollectResponseMaybe (m (ClientPipelinedStIdle (S n) header point tip m a)) → ClientStNext n header point tip m a → ClientPipelinedStIdle (S n) header point tip m a 
SendMsgDone ∷ a → ClientPipelinedStIdle Z header point tip m a 

data ClientStNext n header point tip m a Source #

Callback for responses received after sending MsgRequestNext.

We could receive MsgAwaitReply. In this case we will wait for the next message which must be MsgRollForward or MsgRollBackward; thus we need only the two callbacks.

Constructors

ClientStNext 

Fields

data ClientPipelinedStIntersect header point tip m a Source #

Callbacks for messages received after sending MsgFindIntersect.

We might receive either MsgIntersectFound or MsgIntersectNotFound.

Constructors

ClientPipelinedStIntersect 

Fields

data ChainSyncInstruction header point tip Source #

Data received through pipelining: either roll forward or roll backward instruction. If the server replied with MsgAwaitReply the pipelined receiver will await for the next message which must come with an instruction how to update our chain.

Note: internal API, not exposed by this module.

Constructors

RollForward !header !tip 
RollBackward !point !tip 

chainSyncClientPeerPipelined ∷ ∀ header point tip m a. Monad m ⇒ ChainSyncClientPipelined header point tip m a → PeerPipelined (ChainSync header point tip) AsClient StIdle m a Source #

chainSyncClientPeerSender ∷ ∀ n header point tip m a. Monad m ⇒ Nat n → ClientPipelinedStIdle n header point tip m a → PeerSender (ChainSync header point tip) AsClient StIdle n (ChainSyncInstruction header point tip) m a Source #

mapChainSyncClientPipelined ∷ ∀ header header' point point' tip tip' (m ∷ TypeType) a. Functor m ⇒ (point → point') → (point' → point) → (header' → header) → (tip' → tip) → ChainSyncClientPipelined header point tip m a → ChainSyncClientPipelined header' point' tip' m a Source #

Transform a ChainSyncClientPipelined by mapping over the tx header and the chain tip values.

Note the direction of the individual mapping functions corresponds to whether the types are used as protocol inputs or outputs (or both, as is the case for points).