ouroboros-network-0.1.0.1: A networking layer for the Ouroboros blockchain protocol
Safe Haskell Safe-Inferred
Language Haskell2010

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 a Source #

A chain sync protocol server, on top of some effect m .

Constructors

ChainSyncServer

Fields

data ServerStIdle header point tip m 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 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 :: header -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a
SendMsgRollBackward :: point -> tip -> ChainSyncServer header point tip m a -> ServerStNext header point tip m a

data ServerStIntersect header point tip m 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 :: point -> tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a
SendMsgIntersectNotFound :: tip -> ChainSyncServer header point tip m a -> ServerStIntersect header point tip m a

Execution as a typed protocol

chainSyncServerPeer :: forall header point tip m a. Monad m => ChainSyncServer header point tip m a -> Peer ( ChainSync header point tip) AsServer StIdle m a Source #

Interpret a ChainSyncServer action sequence as a Peer on the server side of the ChainSyncProtocol .