Safe Haskell | None |
---|---|
Language | Haskell2010 |
A view of the chain synchronisation protocol from the point of view of the server.
This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.
For execution, a conversion into the typed protocol is provided.
Synopsis
- newtype ChainSyncServer header point tip (m :: Type -> Type) a = ChainSyncServer {
- runChainSyncServer :: m (ServerStIdle header point tip m a)
- data ServerStIdle header point tip (m :: Type -> Type) a = ServerStIdle {
- recvMsgRequestNext :: m (Either (ServerStNext header point tip m a) (m (ServerStNext header point tip m a)))
- recvMsgFindIntersect :: [point] -> m (ServerStIntersect header point tip m a)
- recvMsgDoneClient :: m a
- data ServerStNext header point tip (m :: Type -> Type) a where
- SendMsgRollForward :: forall header tip point (m :: Type -> Type) a. header -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a
- SendMsgRollBackward :: forall point tip header (m :: Type -> Type) a. point -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a
- data ServerStIntersect header point tip (m :: Type -> Type) a where
- SendMsgIntersectFound :: forall point tip header (m :: Type -> Type) a. point -> tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a
- SendMsgIntersectNotFound :: forall tip header point (m :: Type -> Type) a. tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a
- chainSyncServerPeer :: forall header point tip (m :: Type -> Type) a. Monad m => ChainSyncServer header point tip m a -> Server (ChainSync header point tip) 'NonPipelined ('StIdle :: ChainSync header point tip) m a
Protocol type for the server
The protocol states from the point of view of the server.
newtype ChainSyncServer header point tip (m :: Type -> Type) a Source #
A chain sync protocol server, on top of some effect m
.
ChainSyncServer | |
|
data ServerStIdle header point tip (m :: Type -> Type) a Source #
In the StIdle
protocol state, the server does not have agency. Instead
it is waiting for:
- a next update request
- a find intersection request
- a termination messge
It must be prepared to handle either.
ServerStIdle | |
|
data ServerStNext header point tip (m :: Type -> Type) a where Source #
In the StNext
protocol state, the server has agency and must send either:
- a roll forward
- a roll back message
- a termination message
SendMsgRollForward :: forall header tip point (m :: Type -> Type) a. header -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a | |
SendMsgRollBackward :: forall point tip header (m :: Type -> Type) a. point -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a |
data ServerStIntersect header point tip (m :: Type -> Type) a where Source #
In the StIntersect
protocol state, the server has agency and must send
either:
- an intersection improved,
- unchanged message,
- termination message
SendMsgIntersectFound :: forall point tip header (m :: Type -> Type) a. point -> tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a | |
SendMsgIntersectNotFound :: forall tip header point (m :: Type -> Type) a. tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a |
Execution as a typed protocol
chainSyncServerPeer :: forall header point tip (m :: Type -> Type) a. Monad m => ChainSyncServer header point tip m a -> Server (ChainSync header point tip) 'NonPipelined ('StIdle :: ChainSync header point tip) m a Source #
Interpret a ChainSyncServer
action sequence as a Peer
on the server
side of the ChainSyncProtocol
.