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

Ouroboros.Network.Protocol.ChainSync.Examples

Synopsis

Documentation

chainSyncClientExample :: forall header tip m a. ( HasHeader header, MonadSTM m) => StrictTVar m ( Chain header) -> Client header ( Point header) tip m a -> ChainSyncClient header ( Point header) tip m a Source #

An instance of the client side of the chain sync protocol that consumes into a Chain stored in a StrictTVar .

This is of course only useful in tests and reference implementations since this is not a realistic chain representation.

data Client header point tip m t Source #

Constructors

Client

Fields

pureClient :: Applicative m => Client header point tip m void Source #

A client which doesn't do anything and never ends. Used with chainSyncClientExample , the StrictTVar m (Chain header) will be updated but nothing further will happen.

data Tip b Source #

Used in chain-sync protocol to advertise the tip of the server's chain.

Constructors

TipGenesis

The tip is genesis

Tip ! SlotNo !( HeaderHash b) ! BlockNo

The tip is not genesis

Instances

Instances details
StandardHash b => Eq ( Tip b) Source #
Instance details

Defined in Ouroboros.Network.Block

StandardHash b => Show ( Tip b) Source #
Instance details

Defined in Ouroboros.Network.Block

Generic ( Tip b) Source #
Instance details

Defined in Ouroboros.Network.Block

Associated Types

type Rep ( Tip b) :: Type -> Type Source #

StandardHash b => NoThunks ( Tip b) Source #
Instance details

Defined in Ouroboros.Network.Block

ShowProxy b => ShowProxy ( Tip b :: Type ) Source #
Instance details

Defined in Ouroboros.Network.Block

type Rep ( Tip b) Source #
Instance details

Defined in Ouroboros.Network.Block

chainSyncServerExample :: forall blk header m a. ( HasHeader header, MonadSTM m, HeaderHash header ~ HeaderHash blk) => a -> StrictTVar m ( ChainProducerState header) -> ChainSyncServer header ( Point blk) ( Tip blk) m a Source #

An instance of the server side of the chain sync protocol that reads from a pure ChainProducerState stored in a StrictTVar .

This is of course only useful in tests and reference implementations since this is not a realistic chain representation.