Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype ChainSyncClientPipelined header point tip (m :: Type -> Type) a = ChainSyncClientPipelined {
- runChainSyncClientPipelined :: m (ClientPipelinedStIdle 'Z header point tip m a)
- data ClientPipelinedStIdle (n :: N) header point tip (m :: Type -> Type) a where
- SendMsgRequestNext :: forall (m :: Type -> Type) header point tip a. m () -> ClientStNext 'Z header point tip m a -> ClientPipelinedStIdle 'Z header point tip m a
- SendMsgRequestNextPipelined :: forall (m :: Type -> Type) (n :: N) header point tip a. m () -> ClientPipelinedStIdle ('S n) header point tip m a -> ClientPipelinedStIdle n header point tip m a
- 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 = ClientStNext {
- recvMsgRollForward :: header -> tip -> m (ClientPipelinedStIdle n header point tip m a)
- recvMsgRollBackward :: point -> tip -> m (ClientPipelinedStIdle n header point tip m a)
- data ClientPipelinedStIntersect header point tip (m :: Type -> Type) a = ClientPipelinedStIntersect {
- recvMsgIntersectFound :: point -> tip -> m (ClientPipelinedStIdle 'Z header point tip m a)
- recvMsgIntersectNotFound :: tip -> m (ClientPipelinedStIdle 'Z header point tip m a)
- data ChainSyncInstruction header point tip
- = 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
- 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
- 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
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.
ChainSyncClientPipelined | |
|
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
.
SendMsgRequestNext | |
| |
SendMsgRequestNextPipelined | |
| |
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.
ClientStNext | |
|
data ClientPipelinedStIntersect header point tip (m :: Type -> Type) a Source #
Callbacks for messages received after sending MsgFindIntersect
.
We might receive either MsgIntersectFound
or MsgIntersectNotFound
.
ClientPipelinedStIntersect | |
|
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.
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).