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

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 send relatively seldom and their response might impact how many messages one would like to pipeline. It also simplifies the receiver callback.

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 :: ClientStNext Z header point tip m a -> m ( ClientStNext Z header point tip m a) -> ClientPipelinedStIdle Z header point tip m a
SendMsgRequestNextPipelined :: ClientPipelinedStIdle ( S n) header point tip m a -> ClientPipelinedStIdle n header point tip m a
SendMsgFindIntersect :: [point] -> ClientPipelinedStIntersect header point tip m a -> ClientPipelinedStIdle Z header point tip m a
CollectResponse :: Maybe (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

chainSyncClientPeerSender :: forall 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 :: forall header header' point point' tip tip' (m :: Type -> Type ) 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).