ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.ClientPipelined

Synopsis

Documentation

newtype ChainSyncClientPipelined header point tip (m :: Type -> Type) 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 :: N) header point tip (m :: Type -> Type) 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 :: forall point header tip (m :: Type -> Type) a. [point] -> ClientPipelinedStIntersect header point tip m a -> ClientPipelinedStIdle 'Z header point tip m a 
CollectResponse :: forall (m :: Type -> Type) (n1 :: N) header point tip a. Maybe (m (ClientPipelinedStIdle ('S n1) header point tip m a)) -> ClientStNext n1 header point tip m a -> ClientPipelinedStIdle ('S n1) header point tip m a 
SendMsgDone :: forall a header point tip (m :: Type -> Type). a -> ClientPipelinedStIdle 'Z header point tip m a 

data ClientStNext (n :: N) header point tip (m :: Type -> Type) 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 :: Type -> Type) 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 :: forall header point tip (m :: Type -> Type) a. Monad m => ChainSyncClientPipelined header point tip m a -> ClientPipelined (ChainSync header point tip) ('StIdle :: ChainSync header point tip) m a Source #

chainSyncClientPeerSender :: forall (n :: N) header point tip (m :: Type -> Type) a. Monad m => Nat n -> ClientPipelinedStIdle n header point tip m a -> Client (ChainSync header point tip) ('Pipelined n (ChainSyncInstruction header point tip)) ('StIdle :: ChainSync 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).