ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.Server

Description

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

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.

Constructors

ChainSyncServer 

Fields

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.

Constructors

ServerStIdle 

Fields

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

Constructors

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

Constructors

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.