Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype ChainSyncClient header point tip (m :: Type -> Type) a = ChainSyncClient {
- runChainSyncClient :: m (ClientStIdle header point tip m a)
- data ClientStIdle header point tip (m :: Type -> Type) a where
- SendMsgRequestNext :: forall (m :: Type -> Type) header point tip a. m () -> ClientStNext header point tip m a -> ClientStIdle header point tip m a
- SendMsgFindIntersect :: forall point header tip (m :: Type -> Type) a. [point] -> ClientStIntersect header point tip m a -> ClientStIdle header point tip m a
- SendMsgDone :: forall a header point tip (m :: Type -> Type). a -> ClientStIdle header point tip m a
- data ClientStNext header point tip (m :: Type -> Type) a = ClientStNext {
- recvMsgRollForward :: header -> tip -> ChainSyncClient header point tip m a
- recvMsgRollBackward :: point -> tip -> ChainSyncClient header point tip m a
- data ClientStIntersect header point tip (m :: Type -> Type) a = ClientStIntersect {
- recvMsgIntersectFound :: point -> tip -> ChainSyncClient header point tip m a
- recvMsgIntersectNotFound :: tip -> ChainSyncClient header point tip m a
- chainSyncClientNull :: forall (m :: Type -> Type) header point tip a. MonadTimer m => ChainSyncClient header point tip m a
- mapChainSyncClient :: forall header header' point point' tip tip' (m :: Type -> Type) a. Functor m => (point -> point') -> (point' -> point) -> (header' -> header) -> (tip' -> tip) -> ChainSyncClient header point tip m a -> ChainSyncClient header' point' tip' m a
Protocol type for the client
The protocol states from the point of view of the client.
newtype ChainSyncClient header point tip (m :: Type -> Type) a Source #
A chain sync protocol client, on top of some effect m
.
The first choice of request is within that m
.
ChainSyncClient | |
|
data ClientStIdle header point tip (m :: Type -> Type) a where Source #
In the StIdle
protocol state, the server does not have agency and can choose to
send a request next, or a find intersection message.
SendMsgRequestNext | Send the The handlers for this message are more complicated than most RPCs because
the server can either send us a reply immediately or it can send us a
In the waiting case, the client gets the chance to take a local action. |
| |
SendMsgFindIntersect :: forall point header tip (m :: Type -> Type) a. [point] -> ClientStIntersect header point tip m a -> ClientStIdle header point tip m a | Send the |
SendMsgDone :: forall a header point tip (m :: Type -> Type). a -> ClientStIdle header point tip m a | The client decided to end the protocol. |
data ClientStNext header point tip (m :: Type -> Type) a Source #
In the StNext
protocol state, the client does not have agency and is
waiting to receive either
- a roll forward,
- roll back message,
It must be prepared to handle any of these.
ClientStNext | |
|
data ClientStIntersect header point tip (m :: Type -> Type) a Source #
In the StIntersect
protocol state, the client does not have agency and
is waiting to receive:
- an intersection improved,
- unchanged message,
- the termination message.
It must be prepared to handle any of these.
ClientStIntersect | |
|
Null chain sync client
chainSyncClientNull :: forall (m :: Type -> Type) header point tip a. MonadTimer m => ChainSyncClient header point tip m a Source #
A chain sync client which never sends any message.
Utilities
mapChainSyncClient :: forall header header' point point' tip tip' (m :: Type -> Type) a. Functor m => (point -> point') -> (point' -> point) -> (header' -> header) -> (tip' -> tip) -> ChainSyncClient header point tip m a -> ChainSyncClient header' point' tip' m a Source #
Transform a ChainSyncClient
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).