Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
newtype
ChainSyncClientPipelined
header point tip m a =
ChainSyncClientPipelined
{
- runChainSyncClientPipelined :: m ( ClientPipelinedStIdle Z header point tip m a)
-
data
ClientPipelinedStIdle
n header point tip m a
where
- 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 =
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 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 a. Monad m => ChainSyncClientPipelined header point tip m a -> PeerPipelined ( ChainSync header point tip) AsClient StIdle m a
- 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
- 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 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.
ChainSyncClientPipelined | |
|
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
.
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.
ClientStNext | |
|
data ClientPipelinedStIntersect header point tip m 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 a. Monad m => ChainSyncClientPipelined header point tip m a -> PeerPipelined ( ChainSync header point tip) AsClient StIdle m a Source #
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).